Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

valido

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valido - npm Package Compare versions

Comparing version 1.0.2 to 1.0.4

validators/isNull.js

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 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc