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

async-validate

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-validate - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

test/spec/clone.js

12

lib/iterator.js

@@ -6,3 +6,2 @@ function mapSeries(list, cb, complete) {

cb(item, function(err, result) {
/* istanbul ignore next: not going to mock this */
if(err) {

@@ -26,7 +25,12 @@ return complete(err, out);

function map(list, cb, complete) {
var out = [];
var out = []
, e;
function run(item, index) {
cb(item, function(err, result) {
/* istanbul ignore next: not going to mock this */
if(err) {
// do not call complete again on error
// condition
if(e) {
return;
}else if(err) {
e = err;
return complete(err, out);

@@ -33,0 +37,0 @@ }

@@ -23,3 +23,5 @@ var iterator = require('./iterator')

rules = clone(rules);
// do not clone rules when deep is set
// initial clone is a deep clone
rules = opts.deep ? rules : clone(rules);

@@ -133,4 +135,2 @@ // wrap shorthand declaration without `fields`

//var keys = options.keys || Object.keys(this.rules.fields || this.rules);
// iterate list data

@@ -157,7 +157,2 @@ func(series, function(rule, callback) {

// bail on first error
//if(options.first && errors && errors.length) {
//return complete(err, errors, options, cb);
//}
// not deep so continue on to next in series

@@ -174,4 +169,2 @@ if(!deep) {

//console.log('field key %s', key);
var opts = clone(options)

@@ -305,2 +298,3 @@ , descriptor = rule.fields[key]

}
target = target || (Array.isArray(source) ? [] : {});

@@ -307,0 +301,0 @@ for(k in source) {

{
"name": "async-validate",
"description": "Asynchronous validation for node and the browser",
"version": "0.7.1",
"version": "0.7.2",
"author": "muji <noop@xpm.io>",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -22,2 +22,30 @@ var expect = require('chai').expect

it("should callback with error (mapSeries)", function(done) {
iterator.mapSeries([1,2,3],
function multiply(num, cb) {
cb(new Error('mock error'));
},
function complete(err, results) {
function fn() {
throw err;
}
expect(fn).throws(Error);
done();
});
});
it("should callback with error (map)", function(done) {
iterator.map([1,2,3],
function multiply(num, cb) {
cb(new Error('mock error'));
},
function complete(err, results) {
function fn() {
throw err;
}
expect(fn).throws(Error);
done();
});
});
});
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