tv4-formats
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -50,3 +50,5 @@ (function () { | ||
exports.url = function (value) { | ||
if (validator.isURL(value, { 'require_tld': false })) { | ||
var tldRequired = value.indexOf('localhost') === -1; | ||
if (validator.isURL(value, { 'require_tld': tldRequired })) { | ||
return null; | ||
@@ -53,0 +55,0 @@ } |
{ | ||
"name": "tv4-formats", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Common JSON Schema string format constraints in the form of tv4 validator callbacks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -124,11 +124,15 @@ describe('tv4-formats', function () { | ||
it('validates positively', function () { | ||
it('validates positively 1', function () { | ||
assert.strictEqual(formats.url('https://ikr.su/'), null); | ||
}); | ||
it('validates positively', function () { | ||
it('validates positively 2', function () { | ||
assert.strictEqual(formats.url('http://localhost:3000/'), null); | ||
}); | ||
it('validates negatively', function () { | ||
it('validates negatively 1', function () { | ||
assert(formats.url('http://asdf:3000/').length > 0); | ||
}); | ||
it('validates negatively 2', function () { | ||
assert(formats.url('#clearly# :not: a URL').length > 0); | ||
@@ -135,0 +139,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
26820
274