Comparing version 2.0.0 to 2.0.2
'use strict'; | ||
var isUrl = require('./validators/url'); | ||
var isUri = require('./validators/uri'); | ||
var isWebUrl = require('./validators/webUrl'); | ||
@@ -21,2 +22,3 @@ var isHexColor = require('./validators/hexColor'); | ||
var validators = { | ||
uri: isUri, | ||
url: isUrl, | ||
@@ -40,3 +42,3 @@ webUrl: isWebUrl, | ||
var api = { every: {}, optional: {} }; | ||
var api = { all: {}, optional: {} }; | ||
@@ -47,4 +49,4 @@ // Build API | ||
api[validatorName] = validator; | ||
api.every[validatorName] = function (values, options) { | ||
return validateEvery(values, validator, options); | ||
api.all[validatorName] = function (values, options) { | ||
return validateAll(values, validator, options); | ||
}; | ||
@@ -64,3 +66,3 @@ api.optional[validatorName] = function (value, options) { | ||
*/ | ||
function validateEvery(values, validator, options) { | ||
function validateAll(values, validator, options) { | ||
if (!isArray(values)) { | ||
@@ -67,0 +69,0 @@ return false; |
{ | ||
"name": "valido", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"description": "Validation provider", | ||
@@ -39,3 +39,6 @@ "main": "dist/index.js", | ||
"mocha-eslint": "^2.1.1" | ||
}, | ||
"dependencies": { | ||
"is_js": "^0.8.0" | ||
} | ||
} |
'use strict'; | ||
const isUrl = require('./validators/url'); | ||
const isUri = require('./validators/uri'); | ||
const isWebUrl = require('./validators/webUrl'); | ||
@@ -21,2 +22,3 @@ const isHexColor = require('./validators/hexColor'); | ||
const validators = { | ||
uri: isUri, | ||
url: isUrl, | ||
@@ -40,3 +42,3 @@ webUrl: isWebUrl, | ||
const api = { every: {}, optional: {} }; | ||
const api = { all: {}, optional: {} }; | ||
@@ -47,3 +49,3 @@ // Build API | ||
api[validatorName] = validator; | ||
api.every[validatorName] = (values, options) => validateEvery(values, validator, options); | ||
api.all[validatorName] = (values, options) => validateAll(values, validator, options); | ||
api.optional[validatorName] = (value, options) => validateOptional(value, validator, options); | ||
@@ -60,3 +62,3 @@ }); | ||
*/ | ||
function validateEvery(values, validator, options) { | ||
function validateAll(values, validator, options) { | ||
if (!isArray(values)) { | ||
@@ -63,0 +65,0 @@ return false; |
@@ -53,3 +53,3 @@ 'use strict'; | ||
const values = [test.value, test.value]; | ||
return expect(valido.every[validatorName](values, test.options)).to.equal(test.result); | ||
return expect(valido.all[validatorName](values, test.options)).to.equal(test.result); | ||
}); | ||
@@ -59,5 +59,5 @@ }); | ||
it('should validate an empty list to true', () => { | ||
return expect(valido.every[validatorName]([])).to.equal(true); | ||
return expect(valido.all[validatorName]([])).to.equal(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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49573
63
1444
0
1
+ Addedis_js@^0.8.0
+ Addedis_js@0.8.0(transitive)