JSPM

is-valid-hostname

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38514
  • Score
    100M100P100Q154560F
  • License

Validate hostname based on RFC-3696

Package Exports

  • is-valid-hostname

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-valid-hostname) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-valid-hostname

Validate hostname in JavaScript based on RFC-3696.

Demo

https://lab.miguelmota.com/is-valid-hostname

Install

npm install is-valid-hostname

Usage

const isValidHostname = require('is-valid-hostname')

isValidHostname('localhost') // true
isValidHostname('example.com') // true
isValidHostname('foo.example.com') // true
isValidHostname('bar.foo.example.com') // true
isValidHostname('exa-mple.co.uk') // true
isValidHostname('xn--80ak6aa92e.com') // true
isValidHostname('9gag.com') // true
isValidHostname('exa_mple.com') // false
isValidHostname('-example.com') // false
isValidHostname('example.com:3000') // false
isValidHostname('127.0.0.1') // false

View more examples.

Test

npm test

License

MIT