is-valid-hostname
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,3 @@ module.exports = function isValidHostname(value, opts) { | ||
const validHostnameChars = /^([a-zA-Z0-9-.]+){1,253}$/g | ||
const validHostnameChars = /^[a-zA-Z0-9-.]{1,253}\.?$/g | ||
if (!validHostnameChars.test(value)) { | ||
@@ -8,0 +8,0 @@ return false |
{ | ||
"name": "is-valid-hostname", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Validate hostname based on RFC-3696", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,7 @@ var test = require('tape') | ||
test('is valid hostname', function (t) { | ||
t.plan(85) | ||
t.plan(87) | ||
// tld and subdomains | ||
t.equal(isValidHostname('example.com'), true) | ||
t.equal(isValidHostname('example.com.'), true) | ||
t.equal(isValidHostname('foo.example.com'), true) | ||
@@ -14,2 +15,3 @@ t.equal(isValidHostname('bar.foo.example.com'), true) | ||
t.equal(isValidHostname('a.com'), true) | ||
t.equal(isValidHostname('.com.'), false) | ||
t.equal(isValidHostname('a.b'), true) | ||
@@ -16,0 +18,0 @@ t.equal(isValidHostname('foo.bar.baz'), true) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13201
194