![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | data/ | 2 years ago | - | |
![]() | test/ | 2 years ago | - | |
![]() | example/ | 39 years ago | - | |
![]() | package.json | 2 years ago | 2.1K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | index.js | 39 years ago | 1.6K | |
![]() | README.md | 39 years ago | 1.3K | f12eb36 documentaiton updates [كارل مبارك] |
![]() | LICENSE | 39 years ago | 1.0K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | CHANGELOG.md | 39 years ago | 82 |
Validate domain name in JavaScript
https://lab.miguelmota.com/is-valid-domain
npm install is-valid-domain
const isValidDomain = require('is-valid-domain')
isValidDomain('example.com') // true
isValidDomain('foo.example.com') // true
isValidDomain('bar.foo.example.com') // true
isValidDomain('exa-mple.co.uk') // true
isValidDomain('xn--80ak6aa92e.com') // true
isValidDomain('_dnslink.ipfs.io') // true
isValidDomain('exa_mple.com') // false
isValidDomain('-example.co.uk') // false
isValidDomain('example') // false
isValidDomain('ex*mple.com') // false
isValidDomain('*.example.com') // false
isValidDomain('*.com') // false
isValidDomain(3434) // false
isValidDomain('foo.example.com', {subdomain: true}) // true
isValidDomain('foo.example.com', {subdomain: false}) // false
isValidDomain('*.example.com', {wildcard: false}) // false
isValidDomain('*.example.com', {wildcard: true}) // true
isValidDomain('*.example.com', {subdomain: false, wildcard: true}) // false
view more examples
npm test
Adding new domains:
data/second_level_domains.csv
npm run generate
to generate JSON map filenpm test