Comparing version 1.0.2 to 1.0.4
14
main.js
@@ -7,2 +7,4 @@ 'use strict'; | ||
const isArray = require('./validators/isArray'); | ||
const isNull = require('./validators/isNull'); | ||
const isUndefined = require('./validators/isUndefined'); | ||
@@ -13,6 +15,8 @@ const validators = { | ||
isString, | ||
isArray | ||
isArray, | ||
isNull, | ||
isUndefined | ||
}; | ||
const api = { array: {} }; | ||
const api = { every: {} }; | ||
@@ -22,7 +26,7 @@ Object.getOwnPropertyNames(validators).forEach((validatorName) => { | ||
api[validatorName] = validator.validate; | ||
api.array[validatorName] = (values, options) => validateArray(values, validator, options); | ||
api.every[validatorName] = (values, options) => validateEvery(values, validator, options); | ||
}); | ||
/** | ||
* Validates an array of values | ||
* Validates a list of values | ||
* | ||
@@ -34,3 +38,3 @@ * @param {Array<*>} values - Values | ||
*/ | ||
function validateArray(values, validator, options) { | ||
function validateEvery(values, validator, options) { | ||
if (!isArray.validate(values)) { | ||
@@ -37,0 +41,0 @@ return false; |
{ | ||
"name": "valido", | ||
"version": "1.0.2", | ||
"version": "1.0.4", | ||
"description": "Validation provider", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -40,3 +40,3 @@ 'use strict'; | ||
const values = [test.value, test.value]; | ||
return expect(valido.array[validatorName](values, test.options)) | ||
return expect(valido.every[validatorName](values, test.options)) | ||
.to.equal(test.result); | ||
@@ -47,3 +47,3 @@ }); | ||
it('should validate an empty list to false', () => { | ||
return expect(valido.array[validatorName]([])) | ||
return expect(valido.every[validatorName]([])) | ||
.to.equal(false); | ||
@@ -53,3 +53,3 @@ }); | ||
it('should validate an empty list to true if "allowEmpty" is true', () => { | ||
return expect(valido.array[validatorName]([], { allowEmpty: true })) | ||
return expect(valido.every[validatorName]([], { allowEmpty: true })) | ||
.to.equal(true); | ||
@@ -56,0 +56,0 @@ }); |
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
14150
17
394