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 2.0.0 to 2.0.2

dist/lib/rfc3986.js

10

dist/index.js
'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"
}
}

8

src/index.js
'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);
});
});
});
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