Comparing version 0.2.10 to 0.2.11
135
lib/async.js
@@ -426,6 +426,2 @@ (function() { | ||
if (called) { | ||
return; | ||
} | ||
if (err) { | ||
@@ -598,5 +594,2 @@ called = true; | ||
if (called) { | ||
return; | ||
} | ||
result[index] = res; | ||
@@ -771,5 +764,5 @@ | ||
return opposite ? rejectCallback : detectCallback; | ||
return opposite ? everyCallback : detectCallback; | ||
function rejectCallback(item) { | ||
function everyCallback(item) { | ||
@@ -821,3 +814,2 @@ return function(bool) { | ||
var completed = 0; | ||
var called = false; | ||
var createCallback = getCreateCallback(); | ||
@@ -830,3 +822,3 @@ var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
if (!size) { | ||
return callback([]); | ||
return callback(); | ||
} | ||
@@ -841,3 +833,3 @@ iterate = function() { | ||
if (!size) { | ||
return callback({}); | ||
return callback(); | ||
} | ||
@@ -854,17 +846,12 @@ iterate = function() { | ||
return opposite ? rejectCallback : detectCallback; | ||
return opposite ? everyCallback : detectCallback; | ||
function rejectCallback(item) { | ||
function everyCallback(item) { | ||
return function(bool) { | ||
if (called) { | ||
return; | ||
} | ||
if (!bool) { | ||
called = true; | ||
return callback(item); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(); | ||
@@ -880,11 +867,6 @@ } | ||
if (called) { | ||
return; | ||
} | ||
if (bool) { | ||
called = true; | ||
return callback(item); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(); | ||
@@ -948,5 +930,5 @@ } | ||
return opposite ? rejectCallback : detectCallback; | ||
return opposite ? everyCallback : detectCallback; | ||
function rejectCallback(item) { | ||
function everyCallback(item) { | ||
@@ -996,3 +978,2 @@ return function(bool) { | ||
} | ||
@@ -1225,3 +1206,2 @@ | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
@@ -1256,12 +1236,6 @@ var iterate; | ||
if (called) { | ||
return; | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
@@ -1279,3 +1253,2 @@ } | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
@@ -1310,12 +1283,6 @@ var iterate; | ||
if (called) { | ||
return; | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
@@ -1363,3 +1330,3 @@ } | ||
called = true; | ||
return callback(err); | ||
return callback(err, isArray ? _arrayClone(result) : _objectClone(result)); | ||
} | ||
@@ -1385,3 +1352,2 @@ if (bool === false) { | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
@@ -1414,16 +1380,9 @@ var iterate; | ||
if (called) { | ||
return; | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
return callback(err, result); | ||
} | ||
if (bool === false) { | ||
called = true; | ||
return callback(null, result); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
@@ -1492,3 +1451,3 @@ } | ||
called = true; | ||
return callback(err); | ||
return callback(err, isArray ? _arrayClone(result) : _objectClone(result)); | ||
} | ||
@@ -1659,10 +1618,9 @@ if (bool === false) { | ||
} | ||
if (array) { | ||
Array.prototype.push.apply(result, _isArray(array) ? array : [array]); | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
return callback(err, result); | ||
} | ||
if (_isArray(array) && !!array.length) { | ||
Array.prototype.push.apply(result, array); | ||
} | ||
if (++completed >= size) { | ||
@@ -1683,3 +1641,2 @@ called = true; | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
@@ -1690,2 +1647,5 @@ var iterate; | ||
size = collection.length; | ||
if (!size) { | ||
return callback(null, result); | ||
} | ||
iterate = function() { | ||
@@ -1697,2 +1657,5 @@ _iterator(collection[completed], once(done)); | ||
size = keys.length; | ||
if (!size) { | ||
return callback(null, result); | ||
} | ||
iterate = function() { | ||
@@ -1702,7 +1665,2 @@ _iterator(collection[keys[completed]], once(done)); | ||
} | ||
if (!size) { | ||
return callback(null, result); | ||
} | ||
iterate(); | ||
@@ -1712,14 +1670,9 @@ | ||
if (called) { | ||
return; | ||
if (array) { | ||
Array.prototype.push.apply(result, _isArray(array) ? array : [array]); | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
return callback(err, result); | ||
} | ||
if (_isArray(array) && !!array.length) { | ||
Array.prototype.push.apply(result, array); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
@@ -1732,18 +1685,2 @@ } | ||
function _createBaseIterator(thisArg) { | ||
return function(result, func, key, done) { | ||
var fn = thisArg ? func.bind(thisArg) : func; | ||
fn(function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
result[key] = res; | ||
done(); | ||
}); | ||
}; | ||
} | ||
function concatLimit(collection, limit, iterator, callback, thisArg) { | ||
@@ -1800,9 +1737,9 @@ | ||
if (array) { | ||
Array.prototype.push.apply(result, _isArray(array) ? array : [array]); | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
return callback(err, result); | ||
} | ||
if (_isArray(array) && !!array.length) { | ||
Array.prototype.push.apply(result, array); | ||
} | ||
if (++completed >= size) { | ||
@@ -1820,2 +1757,18 @@ called = true; | ||
function _createBaseIterator(thisArg) { | ||
return function(result, func, key, done) { | ||
var fn = thisArg ? func.bind(thisArg) : func; | ||
fn(function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
result[key] = res; | ||
done(); | ||
}); | ||
}; | ||
} | ||
function parallel(tasks, callback, thisArg) { | ||
@@ -1822,0 +1775,0 @@ |
@@ -1,36 +0,36 @@ | ||
(function(){function s(b){return Object.keys(b)}function r(b){return Array.isArray(b)}function t(b){return"function"==typeof b}function z(b){for(var d=s(b),a=-1,c=d.length,e=Array(c);++a<c;)e[a]=b[d[a]];return e}function E(b){for(var d=-1,a=b.length,c=Array(a);++d<a;)c[d]=b[d];return c}function x(b,d){var a=-1,c=b.length-d;if(0>=c)return[];for(var e=Array(c);++a<c;)e[a]=b[a+d];return e}function ha(b){for(var d=-1,a=b.length,c=Array(a);++d<a;)c[a-d-1]=b[d];return c}function w(b,d){for(var a=-1,c=b.length;++a< | ||
c&&!1!==d(b[a],a,b););return b}function A(b,d,a){a=a||s(b);for(var c=-1,e=a.length;++c<e;){var f=a[c];if(!1===d(b[f],f,b))break}return b}function v(b,d){for(var a=-1;++a<b;)d(a)}function ia(b,d){for(var a=b.length,c=-1;++c<a;)if(!d(b[c]))return!1;return!0}function T(b){for(var d=b.length,a=-1,c=Array(d);++a<d;)c[a]=b[a];return c}function F(b){for(var d=s(b),a=d.length,c=-1,e={};++c<a;){var f=d[c];e[f]=b[f]}return e}function U(b,d){for(var a=-1,c=b.length,e=Array(c);++a<c;)e[a]=(b[a]||{})[d];return e} | ||
function p(b){var d=!1;return function(){if(d){if(arguments[0])return b.apply(B,arguments);throw Error("Callback was already called.");}d=!0;b.apply(B,arguments)}}function G(b,d,a,c){function e(b,c){if(!k){if(b)return k=!0,a(b);if(!1===c)return k=!0,a();++g>=f&&(k=!0,a())}}a=a||function(){};var f=0,g=0,k=!1,h=c?d.bind(c):d;d=function(a){h(a,p(e))};if(r(b)){f=b.length;if(!f)return a();w(b,d)}else{c=s(b);f=c.length;if(!f)return a();A(b,d,c)}}function H(b,d,a,c){function e(b,c){if(!k){if(b)return k= | ||
!0,a(b);if(!1===c||++g>=f)return k=!0,a();l()}}a=a||function(){};var f=0,g=0,k=!1,h=c?d.bind(c):d,l;if(r(b)){f=b.length;if(!f)return a();l=function(){h(b[g],p(e))}}else{var m=s(b),f=m.length;if(!f)return a();l=function(){h(b[m[g]],p(e))}}l()}function V(b,d,a,c,e){function f(a,b){if(!l){if(a)return l=!0,c(a);if(!1===b||++k>=g)return l=!0,c();k>=h+d&&(h=k,n())}}c=c||function(){};var g=0,k=0,h=0,l=!1,m=e?a.bind(e):a,n;if(r(b)){g=b.length;if(!g)return c();n=function(){v(d,function(a){h+a>=g||m(b[h+a], | ||
p(f))})}}else{var q=s(b),g=q.length;if(!g)return c();n=function(){v(d,function(a){h+a>=g||m(b[q[h+a]],p(f))})}}n()}function X(b,d,a,c){function e(b){return function(c,e){if(!l){g[b]=e;if(c)return l=!0,a(c);++h>=f&&(l=!0,a(null,g))}}}a=a||function(){};var f=0,g=[],k=0,h=0,l=!1,m=c?d.bind(c):d;d=function(a){m(a,p(e(k++)))};if(r(b)){f=b.length;if(!f)return a(null,g);w(b,d)}else{c=s(b);f=c.length;if(!f)return a(null,g);A(b,d,c)}}function Y(b,d,a,c){function e(b){return function(c,e){if(!h){g[b]=e;if(c)return h= | ||
!0,a(c);if(++k>=f)return h=!0,a(null,g);m()}}}a=a||function(){};var f=0,g=[],k=0,h=!1,l=c?d.bind(c):d,m;if(r(b)){f=b.length;if(!f)return a(null,g);m=function(){l(b[k],p(e(k)))}}else{var n=s(b),f=n.length;if(!f)return a(null,g);m=function(){l(b[n[k]],p(e(k)))}}m()}function Z(b,d,a,c,e){function f(a){return function(b,e){if(!m){k[a]=e;if(b)return m=!0,c(b);if(++h>=g)return m=!0,c(null,k);h>=l+d&&(l=h,q())}}}c=c||function(){};var g=0,k=[],h=0,l=0,m=!1,n=e?a.bind(e):a,q;if(r(b)){g=b.length;if(!g)return c(null, | ||
k);q=function(){v(d,function(a){l+a>=g||(a=l+a,n(b[a],p(f(a))))})}}else{var u=s(b),g=u.length;if(!g)return c(null,k);q=function(){v(d,function(a){l+a>=g||(a=l+a,n(b[u[a]],p(f(a))))})}}q()}function I(b){function d(a,b,g,d){g=c(a,g);J(a,b,g,d)}function a(a,b,g,d,h){d=c(a,d);K(a,b,g,d,h)}function c(a,b){return function(c){b(r(a)?c:z(c))}}switch(b){case "series":return d;case "limit":return a;default:return function(a,b,d,k){d=c(a,d);L(a,b,d,k)}}}function M(b,d,a,c,e){a=a||function(){};var f=0,g=0,k= | ||
!1,h=function(){function b(c){return function(b){if(!k){if(!b)return k=!0,a(c);++g>=f&&(k=!0,a())}}}function c(b){return function(c){if(!k){if(c)return k=!0,a(b);++g>=f&&(k=!0,a())}}}return e?b:c}(),l=c?d.bind(c):d;d=function(a){l(a,p(h(a)))};if(r(b)){f=b.length;if(!f)return a();w(b,d)}else{f=s(b).length;if(!f)return a();A(b,d)}}function N(b,d,a,c,e){a=a||function(){};var f=0,g=0,k=!1,h=function(){function b(c){return function(b){if(!k){if(!b)return k=!0,a(c);if(++g>=f)return k=!0,a();m()}}}function c(b){return function(c){if(!k){if(c)return k= | ||
!0,a(b);if(++g>=f)return k=!0,a();m()}}}return e?b:c}(),l=c?d.bind(c):d,m;if(r(b)){f=b.length;if(!f)return a([]);m=function(){var a=b[g];l(a,p(h(a)))}}else{var n=s(b),f=n.length;if(!f)return a({});m=function(){var a=b[n[g]];l(a,p(h(a)))}}m()}function O(b,d,a,c,e,f){c=c||function(){};var g=0,k=0,h=0,l=!1,m=function(){function a(b){return function(a){if(!l){if(!a)return l=!0,c(b);if(++k>=g)return c();k>=h+d&&(h=k,q())}}}function b(a){return function(b){if(!l){if(b)return l=!0,c(a);if(++k>=g)return c(); | ||
k>=h+d&&(h=k,q())}}}return f?a:b}(),n=e?a.bind(e):a,q;if(r(b)){g=b.length;if(!g)return c();q=function(){v(d,function(a){h+a>=g||(a=b[h+a],n(a,p(m(a))))})}}else{var u=s(b),g=u.length;if(!g)return c();q=function(){v(d,function(a){h+a>=g||(a=b[u[h+a]],n(a,p(m(a))))})}}q()}function L(b,d,a,c,e){a=a||function(){};var f=0,g=r(b),k={},h=0,l=function(){function b(c,d){return function(b){b||(k[c+""]=d);++h>=f&&a(g?z(k):k)}}function c(b,d){return function(c){c&&(k[b+""]=d);++h>=f&&a(g?z(k):k)}}return e?b:c}(), | ||
m=c?d.bind(c):d;d=function(a,b){m(a,p(l(b,a)))};if(g){f=b.length;if(!f)return a([]);w(b,d)}else{f=s(b).length;if(!f)return a({});A(b,d)}}function J(b,d,a,c,e){a=a||function(){};var f=0,g=r(b),k={},h=0,l=function(){function b(c,d){return function(b){b||(k[c+""]=d);if(++h>=f)return a(g?z(k):k);n()}}function c(b,d){return function(c){c&&(k[b+""]=d);if(++h>=f)return a(g?z(k):k);n()}}return e?b:c}(),m=c?d.bind(c):d,n;if(g){f=b.length;if(!f)return a([]);n=function(){var a=b[h];m(a,p(l(h,a)))}}else{var q= | ||
s(b),f=q.length;if(!f)return a({});n=function(){var a=q[h],c=b[a];m(c,p(l(a,c)))}}n()}function K(b,d,a,c,e,f){c=c||function(){};var g=0,k=r(b),h={},l=0,m=0,n=function(){function a(b,e){return function(a){a||(h[b+""]=e);if(++l>=g)return c(k?z(h):h);l>=m+d&&(m=l,u())}}function b(a,e){return function(b){b&&(h[a+""]=e);if(++l>=g)return c(k?z(h):h);l>=m+d&&(m=l,u())}}return f?a:b}(),q=e?a.bind(e):a,u;if(k){g=b.length;if(!g)return c([]);u=function(){v(d,function(a){if(!(m+a>=g)){a=m+a;var c=b[a];q(c,p(n(a, | ||
c)))}})}}else{var W=s(b),g=W.length;if(!g)return c({});u=function(){v(d,function(a){if(!(m+a>=g)){a=W[m+a];var c=b[a];q(c,p(n(a,c)))}})}}u()}function P(b,d,a,c,e){function f(a,b){if(!h){if(a)return h=!0,c(a);if(++k>=g)return h=!0,c(null,b);m(b)}}c=c||function(){};var g=0,k=0,h=!1,l=e?a.bind(e):a,m;if(r(b)){g=b.length;if(!g)return c(null,d);m=function(a){l(a,b[k],p(f))}}else{var n=s(b),g=n.length;if(!g)return c(null,d);m=function(a){l(a,b[n[k]],p(f))}}m(d)}function $(b,d,a,c){function e(b,c){if(!l){if(b)return l= | ||
!0,a(b);if(!1===c)return l=!0,a(null,g?T(k):F(k));++h>=f&&(l=!0,a(null,k))}}a=a||function(){};var f=0,g=r(b),k=g?[]:{},h=0,l=!1,m=c?d.bind(c):d;d=function(a,b){m(k,a,b,p(e))};if(g){f=b.length;if(!f)return a(null,k);w(b,d)}else{c=s(b);f=c.length;if(!f)return a(null,k);A(b,d,c)}}function aa(b,d,a,c){function e(b,c){if(!l){if(b)return l=!0,a(b);if(!1===c||++h>=f)return l=!0,a(null,k);n()}}a=a||function(){};var f=0,g=r(b),k=g?[]:{},h=0,l=!1,m=c?d.bind(c):d,n;if(g){f=b.length;if(!f)return a(null,k);n= | ||
function(){m(k,b[h],h,p(e))}}else{var q=s(b),f=q.length;if(!f)return a(null,k);n=function(){var a=q[h];m(k,b[a],a,p(e))}}n()}function ba(b,d,a,c,e){function f(a,b){if(!n){if(a)return n=!0,c(a);if(!1===b)return n=!0,c(null,k?T(h):F(h));if(++l>=g)return n=!0,c(null,h);l>=m+d&&(m=l,u())}}c=c||function(){};var g=0,k=r(b),h=k?[]:{},l=0,m=0,n=!1,q=e?a.bind(e):a,u;if(k){g=b.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||(a=m+a,q(h,b[a],a,p(f)))})}}else{var t=s(b),g=t.length;if(!g)return c(null, | ||
h);u=function(){v(d,function(a){m+a>=g||(a=t[m+a],q(h,b[a],a,p(f)))})}}u()}function Q(b){function d(a,b,d,h){b=c(b,h);Y(a,b,e(d))}function a(a,b,d,h,l){d=c(d,l);Z(a,b,d,e(h))}function c(a,b){var c=b?a.bind(b):a;return function(a,b){c(a,function(c,d){if(c)return b(c);b(null,{item:a,criteria:d})})}}function e(a){return function(b,c){if(b)return a(b);var d=c.sort(function(a,b){return b.criteria<a.criteria});a(null,U(d,"item"))}}switch(b){case "series":return d;case "limit":return a;default:return function(a, | ||
b,d,h){b=c(b,h);X(a,b,e(d))}}}function R(b){return function(d,a,c,e){(b?a.bind(b):a)(function(a,b){if(a)return e(a);d[c]=b;e()})}}function ca(){var b=arguments;return function(){var d=this,a=E(arguments),c=a.pop();P(b,a,function(a,b,c){a.push(function(a){var b=x(arguments,1);c(a,b)});b.apply(d,a)},function(a,b){b=r(b)?b:[b];b.unshift(a);c.apply(d,b)})}}function da(b){var d="series"===b?H:G;return function(a){var b=this,e=x(arguments,1),f=e.pop()||function(){};d(a,function(a,d){a.apply(b,e.concat(d))}, | ||
f)}}function ea(b,d,a){function c(a,b,c){var d=r(a)?a:[a];a&&d.length?(e.started=!0,c=t(c)?c:null,w(d,function(a){e.tasks.push({task:a,priority:b,callback:c});e.tasks=e.tasks.sort(function(a,b){return b.priority<a.priority});t(e.saturated)&&e.length()>=e.concurrency&&e.saturated();y(e.process)})):e.idle()&&t(e.drain)&&y(e.drain)}var e={tasks:[],concurrency:d||1,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(a,b,d){c(a,b,d)},kill:function(){e.drain=null;e.tasks=[]},process:function(){function a(){f--; | ||
b.callback&&b.callback.apply(b,arguments);t(e.drain)&&e.idle()&&e.drain();e.process()}if(!(e.paused||f>=e.concurrency)&&e.length()){var b=e.tasks.shift();t(e.empty)&&!e.length()&&e.empty();f++;(e._thisArg?e._worker.bind(e._thisArg):e._worker)(b.task,p(a))}},length:function(){return e.tasks.length},running:function(){return f},idle:function(){return 0===e.length()+f},pause:function(){e.paused=!0},resume:function(){!1!==e.paused&&(e.paused=!1,v(e.concurrency,function(){C.setImmediate(e.process)}))}, | ||
_worker:b,_thisArg:a},f=0;return e}function fa(b,d,a,c){function e(c){return function(d,m){f[c]=m;if(d)return a(d);if(++g>=b)return a(null,f);k(g,p(e(g)))}}a=a||function(){};var f=[];if(1>b)return a(null,f);var g=0,k=c?d.bind(c):d;k(g,p(e(g)))}function S(b){function d(a){var c=x(arguments,1);console&&(a?console.error&&console.error(a):console[b]&&w(c,console[b]))}return function(a){var b=x(arguments,1);b.push(d);a.apply(null,b)}}var B=this,ja=B&&B.async,D,y;(function(){process&&process.nextTick?(D= | ||
process.nextTick,y=t(setImmediate)?function(b){setImmediate(b)}:D):y=D=t(setImmediate)?function(b){setImmediate(b)}:function(b){setTimeout(b,0)}})();var C={each:G,eachSeries:H,eachLimit:V,forEach:G,forEachSeries:H,forEachLimit:V,map:X,mapSeries:Y,mapLimit:Z,filter:I(),filterSeries:I("series"),filterLimit:I("limit"),reject:function(b,d,a,c){L(b,d,a,c,!0)},rejectSeries:function(b,d,a,c){J(b,d,a,c,!0)},rejectLimit:function(b,d,a,c,e){K(b,d,a,c,e,!0)},detect:M,detectSeries:N,detectLimit:O,pick:L,pickSeries:J, | ||
pickLimit:K,reduce:P,reduceRight:function(b,d,a,c,e){function f(a,b){if(!h){if(a)return h=!0,c(a);if(++k>=g)return h=!0,c(null,b);m(b)}}c=c||function(){};var g=0,k=0,h=!1,l=e?a.bind(e):a,m;if(r(b)){g=b.length;if(!g)return c(null,d);m=function(a){l(a,b[g-k-1],p(f))}}else{var n=s(b),g=n.length;if(!g)return c(null,d);m=function(a){l(a,b[n[g-k-1]],p(f))}}m(d)},transform:$,transformSeries:aa,transformLimit:ba,sortBy:Q(),sortBySeries:Q("series"),sortByLimit:Q("limit"),some:function(b,d,a,c){M(b,d,function(b){a(!!b)}, | ||
c)},someSeries:function(b,d,a,c){N(b,d,function(b){a(!!b)},c)},someLimit:function(b,d,a,c,e){O(b,d,a,function(a){c(!!a)},e)},every:function(b,d,a,c){M(b,d,function(b){a(!b)},c,!0)},everySeries:function(b,d,a,c){N(b,d,function(b){a(!b)},c,!0)},everyLimit:function(b,d,a,c,e){O(b,d,a,function(a){c(!a)},e,!0)},concat:function(b,d,a,c){function e(b,c){if(!h){if(b)return h=!0,a(b);r(c)&&c.length&&Array.prototype.push.apply(g,c);++k>=f&&(h=!0,a(null,g))}}a=a||function(){};var f=0,g=[],k=0,h=!1,l=c?d.bind(c): | ||
d;d=function(a){l(a,p(e))};if(r(b)){f=b.length;if(!f)return a(null,g);w(b,d)}else{c=s(b);f=c.length;if(!f)return a(null,g);A(b,d,c)}},concatSeries:function(b,d,a,c){function e(b,c){if(!l){if(b)return l=!0,a(b);r(c)&&c.length&&Array.prototype.push.apply(k,c);if(++h>=f)return l=!0,a(null,k);n()}}a=a||function(){};var f=0,g=r(b),k=[],h=0,l=!1,m=c?d.bind(c):d,n;if(g)f=b.length,n=function(){m(b[h],p(e))};else{var q=s(b),f=q.length;n=function(){m(b[q[h]],p(e))}}if(!f)return a(null,k);n()},concatLimit:function(b, | ||
d,a,c,e){function f(a,b){if(!n){if(a)return n=!0,c(a);r(b)&&b.length&&Array.prototype.push.apply(h,b);if(++l>=g)return n=!0,c(null,h);l>=m+d&&(m=l,u())}}c=c||function(){};var g=0,k=r(b),h=[],l=0,m=0,n=!1,q=e?a.bind(e):a,u;if(k){g=b.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||q(b[m+a],p(f))})}}else{var t=s(b),g=t.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||q(b[t[m+a]],p(f))})}}u()},parallel:function(b,d,a){var c=R(a);$(b,c,d,a)},series:function(b,d,a){var c= | ||
R(a);aa(b,c,d,a)},parallelLimit:function(b,d,a,c){var e=R(c);ba(b,d,e,a,c)},waterfall:function(b,d,a){var c=function(){return a?function(b,c,d){function k(a){if(a)return d(a);var c=x(arguments,1);b.args=c;d(null,b)}var h=b.args||[];switch(h.length){case 0:return c.call(a,k);case 1:return c.call(a,h[0],k);case 2:return c.call(a,h[0],h[1],k);case 3:return c.call(a,h[0],h[1],h[2],k);case 4:return c.call(a,h[0],h[1],h[2],h[3],k);case 5:return c.call(a,h[0],h[1],h[2],h[3],h[4],k);default:return h.push(k), | ||
c.apply(a,h)}}:function(a,b,c){function d(b){if(b)return c(b);var f=x(arguments,1);a.args=f;c(null,a)}var h=a.args||[];switch(h.length){case 0:return b(d);case 1:return b(h[0],d);case 2:return b(h[0],h[1],d);case 3:return b(h[0],h[1],h[2],d);case 4:return b(h[0],h[1],h[2],h[3],d);case 5:return b(h[0],h[1],h[2],h[3],h[4],d);default:return h.push(d),b.apply(null,h)}}}();P(b,{},c,function(b,c){if(b)return d(b);var g=c.args||[];g.unshift(b);d.apply(a,g)})},whilst:function(b,d,a,c){function e(){b()?f(function(b){if(b)return a(b); | ||
e()}):a()}a=a||function(){};var f=c?d.bind(c):d;e()},doWhilst:function(b,d,a,c){function e(){f(function(b){if(b)return a(b);var f=x(arguments,1);d.apply(c,f)?e():a()})}a=a||function(){};var f=c?b.bind(c):b;e()},until:function(b,d,a,c){function e(){b()?a():f(function(b){if(b)return a(b);e()})}a=a||function(){};var f=c?d.bind(c):d;e()},doUntil:function(b,d,a,c){function e(){f(function(b){if(b)return a(b);var f=x(arguments,1);d.apply(c,f)?a():e()})}a=a||function(){};var f=c?b.bind(c):b;e()},forever:function(b, | ||
d,a){function c(){e(function(a){if(a)return d(a);c()})}d=d||function(){};var e=a?b.bind(a):b;c()},compose:function(){return ca.apply(null,ha(arguments))},seq:ca,applyEach:da(),applyEachSeries:da("series"),queue:function(b,d,a){function c(a,b,c){var d=r(a)?a:[a];a&&d.length?(e.started=!0,b=t(b)?b:null,w(d,function(a){a={task:a,callback:b};c?e.tasks.unshift(a):e.tasks.push(a);t(e.saturated)&&e.length()>=e.concurrency&&e.saturated();y(e.process)})):e.idle()&&t(e.drain)&&y(e.drain)}var e=ea(b,d,a);e.unshift= | ||
function(a,b){c(a,b,!0)};e.push=function(a,b){c(a,b)};return e},priorityQueue:ea,cargo:function(b,d){var a={tasks:[],payload:d,saturated:null,empty:null,drain:null,drained:!0,push:function(b,c){b=r(b)?b:[b];c=t(c)?c:null;w(b,function(b){a.tasks.push({data:b,callback:c});a.drained=!1;t(a.saturated)&&a.length()===a.payload&&a.saturated()});y(a.process)},process:function(){if(!c)if(a.length()){var e="number"==typeof a.payload?a.tasks.splice(0,d):a.tasks,f=U(e,"data");!a.length()&&t(a.empty)&&a.empty(); | ||
c=!0;b(f,function(){c=!1;var b=arguments;w(e,function(a){a.callback&&a.callback.apply(null,b)});a.process()})}else t(a.drain)&&!a.drained&&a.drain(),a.drained=!0},length:function(){return a.tasks.length},running:function(){return c}},c=!1;return a},auto:function(b,d){function a(a){g.unshift(a)}function c(){f--;w(g.slice(0),function(a){a()})}d=d?p(d):function(){};var e=s(b),f=e.length;if(!f)return d();var g=[],k={};a(function(){f||d(null,k)});A(b,function(b,e){function f(a){var b=x(arguments,1);1>= | ||
b.length&&(b=b[0]);if(a){var g=F(k);g[e]=b;return d(a,g)}k[e]=b;y(c)}function n(){return!k.hasOwnProperty(e)&&ia(s,function(a){return k.hasOwnProperty(a)})}function q(){if(n()){var a;a:{a=-1;for(var b=g.length;++a<b;)if(g[a]===q)break a;a=-1}0<=a&&g.splice(a,1);t(f,k)}}b=r(b)?b:[b];var p=b.length,s=b.slice(0,p-1),t=b[p-1];if(n())return t(f,k);a(q)},e)},retry:function(b,d,a){function c(c,f){a=c||a||function(){};var g,k;fa(b,function(a,c){d(function(d,e){g=d;k=e;if(!d)return c(!0);c(d&&a===b-1)},f)}, | ||
function(){a(g,k)})}t(b)&&(a=d,d=b,b=5);b=parseInt(b,10)||5;return t(a)?c():c},iterator:function(b){function d(e){var f=function(){a&&b[c[e]||e].apply(null,arguments);return f.next()};f.next=function(){return e<a-1?d(e+1):null};return f}var a=0,c=[];r(b)?a=b.length:(c=s(b),a=c.length);return d(0)},apply:function(b){var d=x(arguments,1);return function(){b.apply(null,Array.prototype.concat.apply(d,E(arguments)))}},nextTick:D,setImmediate:y,times:function(b,d,a,c){function e(c){return function(d,e){if(!g){f[c]= | ||
e;if(d)return g=!0,a(d);++k>=b&&(g=!0,a(null,f))}}}a=a||function(){};var f=[];if(1>b)return a(null,f);var g=!1,k=0,h=c?d.bind(c):d;v(b,function(a){h(a,p(e(a)))})},timesSeries:fa,timesLimit:function(b,d,a,c,e){function f(a){return function(e,f){if(!k){g[a]=f;if(e)return k=!0,c(e);if(++h>=b)return k=!0,c(null,g);h>=l+d&&(l=h,n())}}}c=c||function(){};var g=[];if(1>b)return c(null,g);var k=!1,h=0,l=0,m=e?a.bind(e):a,n=function(){v(d,function(a){l+a>=b||(a=l+a,m(a,p(f(a))))})};n()},memoize:function(b, | ||
d,a){d=d||function(a){return a};var c={},e={},f=function(){function f(){var b=E(arguments);c[l]=b;var d=e[l];delete e[l];for(var g=-1,h=d.length;++g<h;)d[g].apply(a,b)}var k=E(arguments),h=k.pop(),l=d.apply(null,k);if(c.hasOwnProperty(l))D(function(){h.apply(a,c[l])});else{if(e.hasOwnProperty(l))return e[l].push(h);e[l]=[h];k.push(f);b.apply(a,k)}};f.memo=c;f.unmemoized=b;return f},unmemoize:function(b){return function(){return(b.unmemoized||b).apply(null,arguments)}},log:S("log"),dir:S("dir"),createLogger:S, | ||
noConflict:function(){B.async=ja;return C}},ga={"function":!0,object:!0};ga[typeof module]&&module&&module.exports?module.exports=C:ga[typeof define]&&define&&define.amd?define([],function(){return C}):B.async=C}).call(this); | ||
(function(){function s(b){return Object.keys(b)}function q(b){return Array.isArray(b)}function r(b){return"function"==typeof b}function z(b){for(var d=s(b),a=-1,c=d.length,e=Array(c);++a<c;)e[a]=b[d[a]];return e}function F(b){for(var d=-1,a=b.length,c=Array(a);++d<a;)c[d]=b[d];return c}function x(b,d){var a=-1,c=b.length-d;if(0>=c)return[];for(var e=Array(c);++a<c;)e[a]=b[a+d];return e}function ga(b){for(var d=-1,a=b.length,c=Array(a);++d<a;)c[a-d-1]=b[d];return c}function w(b,d){for(var a=-1,c=b.length;++a< | ||
c&&!1!==d(b[a],a,b););return b}function A(b,d,a){a=a||s(b);for(var c=-1,e=a.length;++c<e;){var f=a[c];if(!1===d(b[f],f,b))break}return b}function v(b,d){for(var a=-1;++a<b;)d(a)}function ha(b,d){for(var a=b.length,c=-1;++c<a;)if(!d(b[c]))return!1;return!0}function G(b){for(var d=b.length,a=-1,c=Array(d);++a<d;)c[a]=b[a];return c}function C(b){for(var d=s(b),a=d.length,c=-1,e={};++c<a;){var f=d[c];e[f]=b[f]}return e}function U(b,d){for(var a=-1,c=b.length,e=Array(c);++a<c;)e[a]=(b[a]||{})[d];return e} | ||
function n(b){var d=!1;return function(){if(d){if(arguments[0])return b.apply(B,arguments);throw Error("Callback was already called.");}d=!0;b.apply(B,arguments)}}function H(b,d,a,c){function e(b,c){if(!k){if(b)return k=!0,a(b);if(!1===c)return k=!0,a();++g>=f&&(k=!0,a())}}a=a||function(){};var f=0,g=0,k=!1,h=c?d.bind(c):d;d=function(a){h(a,n(e))};if(q(b)){f=b.length;if(!f)return a();w(b,d)}else{c=s(b);f=c.length;if(!f)return a();A(b,d,c)}}function I(b,d,a,c){function e(b,c){if(b)return a(b);if(!1=== | ||
c||++g>=f)return a();h()}a=a||function(){};var f=0,g=0,k=c?d.bind(c):d,h;if(q(b)){f=b.length;if(!f)return a();h=function(){k(b[g],n(e))}}else{var l=s(b),f=l.length;if(!f)return a();h=function(){k(b[l[g]],n(e))}}h()}function V(b,d,a,c,e){function f(a,b){if(!l){if(a)return l=!0,c(a);if(!1===b||++k>=g)return l=!0,c();k>=h+d&&(h=k,p())}}c=c||function(){};var g=0,k=0,h=0,l=!1,m=e?a.bind(e):a,p;if(q(b)){g=b.length;if(!g)return c();p=function(){v(d,function(a){h+a>=g||m(b[h+a],n(f))})}}else{var t=s(b),g= | ||
t.length;if(!g)return c();p=function(){v(d,function(a){h+a>=g||m(b[t[h+a]],n(f))})}}p()}function W(b,d,a,c){function e(b){return function(c,e){if(!l){g[b]=e;if(c)return l=!0,a(c);++h>=f&&(l=!0,a(null,g))}}}a=a||function(){};var f=0,g=[],k=0,h=0,l=!1,m=c?d.bind(c):d;d=function(a){m(a,n(e(k++)))};if(q(b)){f=b.length;if(!f)return a(null,g);w(b,d)}else{c=s(b);f=c.length;if(!f)return a(null,g);A(b,d,c)}}function X(b,d,a,c){function e(b){return function(c,e){g[b]=e;if(c)return a(c);if(++k>=f)return a(null, | ||
g);l()}}a=a||function(){};var f=0,g=[],k=0,h=c?d.bind(c):d,l;if(q(b)){f=b.length;if(!f)return a(null,g);l=function(){h(b[k],n(e(k)))}}else{var m=s(b),f=m.length;if(!f)return a(null,g);l=function(){h(b[m[k]],n(e(k)))}}l()}function Y(b,d,a,c,e){function f(a){return function(b,e){if(!m){k[a]=e;if(b)return m=!0,c(b);if(++h>=g)return m=!0,c(null,k);h>=l+d&&(l=h,t())}}}c=c||function(){};var g=0,k=[],h=0,l=0,m=!1,p=e?a.bind(e):a,t;if(q(b)){g=b.length;if(!g)return c(null,k);t=function(){v(d,function(a){l+ | ||
a>=g||(a=l+a,p(b[a],n(f(a))))})}}else{var u=s(b),g=u.length;if(!g)return c(null,k);t=function(){v(d,function(a){l+a>=g||(a=l+a,p(b[u[a]],n(f(a))))})}}t()}function J(b){function d(a,b,g,d){g=c(a,g);K(a,b,g,d)}function a(a,b,g,d,h){d=c(a,d);L(a,b,g,d,h)}function c(a,b){return function(c){b(q(a)?c:z(c))}}switch(b){case "series":return d;case "limit":return a;default:return function(a,b,d,k){d=c(a,d);M(a,b,d,k)}}}function N(b,d,a,c,e){a=a||function(){};var f=0,g=0,k=!1,h=function(){function b(c){return function(b){if(!k){if(!b)return k= | ||
!0,a(c);++g>=f&&(k=!0,a())}}}function c(b){return function(c){if(!k){if(c)return k=!0,a(b);++g>=f&&(k=!0,a())}}}return e?b:c}(),l=c?d.bind(c):d;d=function(a){l(a,n(h(a)))};if(q(b)){f=b.length;if(!f)return a();w(b,d)}else{f=s(b).length;if(!f)return a();A(b,d)}}function O(b,d,a,c,e){a=a||function(){};var f=0,g=0,k=function(){function b(c){return function(b){if(!b)return a(c);if(++g>=f)return a();l()}}function c(b){return function(c){if(c)return a(b);if(++g>=f)return a();l()}}return e?b:c}(),h=c?d.bind(c): | ||
d,l;if(q(b)){f=b.length;if(!f)return a();l=function(){var a=b[g];h(a,n(k(a)))}}else{var m=s(b),f=m.length;if(!f)return a();l=function(){var a=b[m[g]];h(a,n(k(a)))}}l()}function P(b,d,a,c,e,f){c=c||function(){};var g=0,k=0,h=0,l=!1,m=function(){function a(b){return function(a){if(!l){if(!a)return l=!0,c(b);if(++k>=g)return c();k>=h+d&&(h=k,t())}}}function b(a){return function(b){if(!l){if(b)return l=!0,c(a);if(++k>=g)return c();k>=h+d&&(h=k,t())}}}return f?a:b}(),p=e?a.bind(e):a,t;if(q(b)){g=b.length; | ||
if(!g)return c();t=function(){v(d,function(a){h+a>=g||(a=b[h+a],p(a,n(m(a))))})}}else{var u=s(b),g=u.length;if(!g)return c();t=function(){v(d,function(a){h+a>=g||(a=b[u[h+a]],p(a,n(m(a))))})}}t()}function M(b,d,a,c,e){a=a||function(){};var f=0,g=q(b),k={},h=0,l=function(){function b(c,d){return function(b){b||(k[c+""]=d);++h>=f&&a(g?z(k):k)}}function c(b,d){return function(c){c&&(k[b+""]=d);++h>=f&&a(g?z(k):k)}}return e?b:c}(),m=c?d.bind(c):d;d=function(a,b){m(a,n(l(b,a)))};if(g){f=b.length;if(!f)return a([]); | ||
w(b,d)}else{f=s(b).length;if(!f)return a({});A(b,d)}}function K(b,d,a,c,e){a=a||function(){};var f=0,g=q(b),k={},h=0,l=function(){function b(c,d){return function(b){b||(k[c+""]=d);if(++h>=f)return a(g?z(k):k);p()}}function c(b,d){return function(c){c&&(k[b+""]=d);if(++h>=f)return a(g?z(k):k);p()}}return e?b:c}(),m=c?d.bind(c):d,p;if(g){f=b.length;if(!f)return a([]);p=function(){var a=b[h];m(a,n(l(h,a)))}}else{var t=s(b),f=t.length;if(!f)return a({});p=function(){var a=t[h],c=b[a];m(c,n(l(a,c)))}}p()} | ||
function L(b,d,a,c,e,f){c=c||function(){};var g=0,k=q(b),h={},l=0,m=0,p=function(){function a(b,e){return function(a){a||(h[b+""]=e);if(++l>=g)return c(k?z(h):h);l>=m+d&&(m=l,u())}}function b(a,e){return function(b){b&&(h[a+""]=e);if(++l>=g)return c(k?z(h):h);l>=m+d&&(m=l,u())}}return f?a:b}(),t=e?a.bind(e):a,u;if(k){g=b.length;if(!g)return c([]);u=function(){v(d,function(a){if(!(m+a>=g)){a=m+a;var c=b[a];t(c,n(p(a,c)))}})}}else{var r=s(b),g=r.length;if(!g)return c({});u=function(){v(d,function(a){if(!(m+ | ||
a>=g)){a=r[m+a];var c=b[a];t(c,n(p(a,c)))}})}}u()}function Q(b,d,a,c,e){function f(a,b){if(a)return c(a);if(++k>=g)return c(null,b);l(b)}c=c||function(){};var g=0,k=0,h=e?a.bind(e):a,l;if(q(b)){g=b.length;if(!g)return c(null,d);l=function(a){h(a,b[k],n(f))}}else{var m=s(b),g=m.length;if(!g)return c(null,d);l=function(a){h(a,b[m[k]],n(f))}}l(d)}function Z(b,d,a,c){function e(b,c){if(!l){if(b)return l=!0,a(b,g?G(k):C(k));if(!1===c)return l=!0,a(null,g?G(k):C(k));++h>=f&&(l=!0,a(null,k))}}a=a||function(){}; | ||
var f=0,g=q(b),k=g?[]:{},h=0,l=!1,m=c?d.bind(c):d;d=function(a,b){m(k,a,b,n(e))};if(g){f=b.length;if(!f)return a(null,k);w(b,d)}else{c=s(b);f=c.length;if(!f)return a(null,k);A(b,d,c)}}function $(b,d,a,c){function e(b,c){if(b)return a(b,k);if(!1===c||++h>=f)return a(null,k);m()}a=a||function(){};var f=0,g=q(b),k=g?[]:{},h=0,l=c?d.bind(c):d,m;if(g){f=b.length;if(!f)return a(null,k);m=function(){l(k,b[h],h,n(e))}}else{var p=s(b),f=p.length;if(!f)return a(null,k);m=function(){var a=p[h];l(k,b[a],a,n(e))}}m()} | ||
function aa(b,d,a,c,e){function f(a,b){if(!p){if(a)return p=!0,c(a,k?G(h):C(h));if(!1===b)return p=!0,c(null,k?G(h):C(h));if(++l>=g)return p=!0,c(null,h);l>=m+d&&(m=l,u())}}c=c||function(){};var g=0,k=q(b),h=k?[]:{},l=0,m=0,p=!1,t=e?a.bind(e):a,u;if(k){g=b.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||(a=m+a,t(h,b[a],a,n(f)))})}}else{var r=s(b),g=r.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||(a=r[m+a],t(h,b[a],a,n(f)))})}}u()}function R(b){function d(a, | ||
b,d,h){b=c(b,h);X(a,b,e(d))}function a(a,b,d,h,l){d=c(d,l);Y(a,b,d,e(h))}function c(a,b){var c=b?a.bind(b):a;return function(a,b){c(a,function(c,d){if(c)return b(c);b(null,{item:a,criteria:d})})}}function e(a){return function(b,c){if(b)return a(b);var d=c.sort(function(a,b){return b.criteria<a.criteria});a(null,U(d,"item"))}}switch(b){case "series":return d;case "limit":return a;default:return function(a,b,d,h){b=c(b,h);W(a,b,e(d))}}}function S(b){return function(d,a,c,e){(b?a.bind(b):a)(function(a, | ||
b){if(a)return e(a);d[c]=b;e()})}}function ba(){var b=arguments;return function(){var d=this,a=F(arguments),c=a.pop();Q(b,a,function(a,b,c){a.push(function(a){var b=x(arguments,1);c(a,b)});b.apply(d,a)},function(a,b){b=q(b)?b:[b];b.unshift(a);c.apply(d,b)})}}function ca(b){var d="series"===b?I:H;return function(a){var b=this,e=x(arguments,1),f=e.pop()||function(){};d(a,function(a,d){a.apply(b,e.concat(d))},f)}}function da(b,d,a){function c(a,b,c){var d=q(a)?a:[a];a&&d.length?(e.started=!0,c=r(c)? | ||
c:null,w(d,function(a){e.tasks.push({task:a,priority:b,callback:c});e.tasks=e.tasks.sort(function(a,b){return b.priority<a.priority});r(e.saturated)&&e.length()>=e.concurrency&&e.saturated();y(e.process)})):e.idle()&&r(e.drain)&&y(e.drain)}var e={tasks:[],concurrency:d||1,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(a,b,d){c(a,b,d)},kill:function(){e.drain=null;e.tasks=[]},process:function(){function a(){f--;b.callback&&b.callback.apply(b,arguments);r(e.drain)&&e.idle()&& | ||
e.drain();e.process()}if(!(e.paused||f>=e.concurrency)&&e.length()){var b=e.tasks.shift();r(e.empty)&&!e.length()&&e.empty();f++;(e._thisArg?e._worker.bind(e._thisArg):e._worker)(b.task,n(a))}},length:function(){return e.tasks.length},running:function(){return f},idle:function(){return 0===e.length()+f},pause:function(){e.paused=!0},resume:function(){!1!==e.paused&&(e.paused=!1,v(e.concurrency,function(){D.setImmediate(e.process)}))},_worker:b,_thisArg:a},f=0;return e}function ea(b,d,a,c){function e(c){return function(d, | ||
m){f[c]=m;if(d)return a(d);if(++g>=b)return a(null,f);k(g,n(e(g)))}}a=a||function(){};var f=[];if(1>b)return a(null,f);var g=0,k=c?d.bind(c):d;k(g,n(e(g)))}function T(b){function d(a){var c=x(arguments,1);console&&(a?console.error&&console.error(a):console[b]&&w(c,console[b]))}return function(a){var b=x(arguments,1);b.push(d);a.apply(null,b)}}var B=this,ia=B&&B.async,E,y;(function(){process&&process.nextTick?(E=process.nextTick,y=r(setImmediate)?function(b){setImmediate(b)}:E):y=E=r(setImmediate)? | ||
function(b){setImmediate(b)}:function(b){setTimeout(b,0)}})();var D={each:H,eachSeries:I,eachLimit:V,forEach:H,forEachSeries:I,forEachLimit:V,map:W,mapSeries:X,mapLimit:Y,filter:J(),filterSeries:J("series"),filterLimit:J("limit"),reject:function(b,d,a,c){M(b,d,a,c,!0)},rejectSeries:function(b,d,a,c){K(b,d,a,c,!0)},rejectLimit:function(b,d,a,c,e){L(b,d,a,c,e,!0)},detect:N,detectSeries:O,detectLimit:P,pick:M,pickSeries:K,pickLimit:L,reduce:Q,reduceRight:function(b,d,a,c,e){function f(a,b){if(a)return c(a); | ||
if(++k>=g)return c(null,b);l(b)}c=c||function(){};var g=0,k=0,h=e?a.bind(e):a,l;if(q(b)){g=b.length;if(!g)return c(null,d);l=function(a){h(a,b[g-k-1],n(f))}}else{var m=s(b),g=m.length;if(!g)return c(null,d);l=function(a){h(a,b[m[g-k-1]],n(f))}}l(d)},transform:Z,transformSeries:$,transformLimit:aa,sortBy:R(),sortBySeries:R("series"),sortByLimit:R("limit"),some:function(b,d,a,c){N(b,d,function(b){a(!!b)},c)},someSeries:function(b,d,a,c){O(b,d,function(b){a(!!b)},c)},someLimit:function(b,d,a,c,e){P(b, | ||
d,a,function(a){c(!!a)},e)},every:function(b,d,a,c){N(b,d,function(b){a(!b)},c,!0)},everySeries:function(b,d,a,c){O(b,d,function(b){a(!b)},c,!0)},everyLimit:function(b,d,a,c,e){P(b,d,a,function(a){c(!a)},e,!0)},concat:function(b,d,a,c){function e(b,c){if(!h){c&&Array.prototype.push.apply(g,q(c)?c:[c]);if(b)return h=!0,a(b,g);++k>=f&&(h=!0,a(null,g))}}a=a||function(){};var f=0,g=[],k=0,h=!1,l=c?d.bind(c):d;d=function(a){l(a,n(e))};if(q(b)){f=b.length;if(!f)return a(null,g);w(b,d)}else{c=s(b);f=c.length; | ||
if(!f)return a(null,g);A(b,d,c)}},concatSeries:function(b,d,a,c){function e(b,c){c&&Array.prototype.push.apply(k,q(c)?c:[c]);if(b)return a(b,k);if(++h>=f)return a(null,k);m()}a=a||function(){};var f=0,g=q(b),k=[],h=0,l=c?d.bind(c):d,m;if(g){f=b.length;if(!f)return a(null,k);m=function(){l(b[h],n(e))}}else{var p=s(b),f=p.length;if(!f)return a(null,k);m=function(){l(b[p[h]],n(e))}}m()},concatLimit:function(b,d,a,c,e){function f(a,b){if(!p){b&&Array.prototype.push.apply(h,q(b)?b:[b]);if(a)return p=!0, | ||
c(a,h);if(++l>=g)return p=!0,c(null,h);l>=m+d&&(m=l,u())}}c=c||function(){};var g=0,k=q(b),h=[],l=0,m=0,p=!1,t=e?a.bind(e):a,u;if(k){g=b.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||t(b[m+a],n(f))})}}else{var r=s(b),g=r.length;if(!g)return c(null,h);u=function(){v(d,function(a){m+a>=g||t(b[r[m+a]],n(f))})}}u()},parallel:function(b,d,a){var c=S(a);Z(b,c,d,a)},series:function(b,d,a){var c=S(a);$(b,c,d,a)},parallelLimit:function(b,d,a,c){var e=S(c);aa(b,d,e,a,c)},waterfall:function(b, | ||
d,a){var c=function(){return a?function(b,c,d){function k(a){if(a)return d(a);var c=x(arguments,1);b.args=c;d(null,b)}var h=b.args||[];switch(h.length){case 0:return c.call(a,k);case 1:return c.call(a,h[0],k);case 2:return c.call(a,h[0],h[1],k);case 3:return c.call(a,h[0],h[1],h[2],k);case 4:return c.call(a,h[0],h[1],h[2],h[3],k);case 5:return c.call(a,h[0],h[1],h[2],h[3],h[4],k);default:return h.push(k),c.apply(a,h)}}:function(a,b,c){function d(b){if(b)return c(b);var f=x(arguments,1);a.args=f;c(null, | ||
a)}var h=a.args||[];switch(h.length){case 0:return b(d);case 1:return b(h[0],d);case 2:return b(h[0],h[1],d);case 3:return b(h[0],h[1],h[2],d);case 4:return b(h[0],h[1],h[2],h[3],d);case 5:return b(h[0],h[1],h[2],h[3],h[4],d);default:return h.push(d),b.apply(null,h)}}}();Q(b,{},c,function(b,c){if(b)return d(b);var g=c.args||[];g.unshift(b);d.apply(a,g)})},whilst:function(b,d,a,c){function e(){b()?f(function(b){if(b)return a(b);e()}):a()}a=a||function(){};var f=c?d.bind(c):d;e()},doWhilst:function(b, | ||
d,a,c){function e(){f(function(b){if(b)return a(b);var f=x(arguments,1);d.apply(c,f)?e():a()})}a=a||function(){};var f=c?b.bind(c):b;e()},until:function(b,d,a,c){function e(){b()?a():f(function(b){if(b)return a(b);e()})}a=a||function(){};var f=c?d.bind(c):d;e()},doUntil:function(b,d,a,c){function e(){f(function(b){if(b)return a(b);var f=x(arguments,1);d.apply(c,f)?a():e()})}a=a||function(){};var f=c?b.bind(c):b;e()},forever:function(b,d,a){function c(){e(function(a){if(a)return d(a);c()})}d=d||function(){}; | ||
var e=a?b.bind(a):b;c()},compose:function(){return ba.apply(null,ga(arguments))},seq:ba,applyEach:ca(),applyEachSeries:ca("series"),queue:function(b,d,a){function c(a,b,c){var d=q(a)?a:[a];a&&d.length?(e.started=!0,b=r(b)?b:null,w(d,function(a){a={task:a,callback:b};c?e.tasks.unshift(a):e.tasks.push(a);r(e.saturated)&&e.length()>=e.concurrency&&e.saturated();y(e.process)})):e.idle()&&r(e.drain)&&y(e.drain)}var e=da(b,d,a);e.unshift=function(a,b){c(a,b,!0)};e.push=function(a,b){c(a,b)};return e},priorityQueue:da, | ||
cargo:function(b,d){var a={tasks:[],payload:d,saturated:null,empty:null,drain:null,drained:!0,push:function(b,c){b=q(b)?b:[b];c=r(c)?c:null;w(b,function(b){a.tasks.push({data:b,callback:c});a.drained=!1;r(a.saturated)&&a.length()===a.payload&&a.saturated()});y(a.process)},process:function(){if(!c)if(a.length()){var e="number"==typeof a.payload?a.tasks.splice(0,d):a.tasks,f=U(e,"data");!a.length()&&r(a.empty)&&a.empty();c=!0;b(f,function(){c=!1;var b=arguments;w(e,function(a){a.callback&&a.callback.apply(null, | ||
b)});a.process()})}else r(a.drain)&&!a.drained&&a.drain(),a.drained=!0},length:function(){return a.tasks.length},running:function(){return c}},c=!1;return a},auto:function(b,d){function a(a){g.unshift(a)}function c(){f--;w(g.slice(0),function(a){a()})}d=d?n(d):function(){};var e=s(b),f=e.length;if(!f)return d();var g=[],k={};a(function(){f||d(null,k)});A(b,function(b,e){function f(a){var b=x(arguments,1);1>=b.length&&(b=b[0]);if(a){var g=C(k);g[e]=b;return d(a,g)}k[e]=b;y(c)}function p(){return!k.hasOwnProperty(e)&& | ||
ha(s,function(a){return k.hasOwnProperty(a)})}function n(){if(p()){var a;a:{a=-1;for(var b=g.length;++a<b;)if(g[a]===n)break a;a=-1}0<=a&&g.splice(a,1);r(f,k)}}b=q(b)?b:[b];var u=b.length,s=b.slice(0,u-1),r=b[u-1];if(p())return r(f,k);a(n)},e)},retry:function(b,d,a){function c(c,f){a=c||a||function(){};var g,k;ea(b,function(a,c){d(function(d,e){g=d;k=e;if(!d)return c(!0);c(d&&a===b-1)},f)},function(){a(g,k)})}r(b)&&(a=d,d=b,b=5);b=parseInt(b,10)||5;return r(a)?c():c},iterator:function(b){function d(e){var f= | ||
function(){a&&b[c[e]||e].apply(null,arguments);return f.next()};f.next=function(){return e<a-1?d(e+1):null};return f}var a=0,c=[];q(b)?a=b.length:(c=s(b),a=c.length);return d(0)},apply:function(b){var d=x(arguments,1);return function(){b.apply(null,Array.prototype.concat.apply(d,F(arguments)))}},nextTick:E,setImmediate:y,times:function(b,d,a,c){function e(c){return function(d,e){if(!g){f[c]=e;if(d)return g=!0,a(d);++k>=b&&(g=!0,a(null,f))}}}a=a||function(){};var f=[];if(1>b)return a(null,f);var g= | ||
!1,k=0,h=c?d.bind(c):d;v(b,function(a){h(a,n(e(a)))})},timesSeries:ea,timesLimit:function(b,d,a,c,e){function f(a){return function(e,f){if(!k){g[a]=f;if(e)return k=!0,c(e);if(++h>=b)return k=!0,c(null,g);h>=l+d&&(l=h,p())}}}c=c||function(){};var g=[];if(1>b)return c(null,g);var k=!1,h=0,l=0,m=e?a.bind(e):a,p=function(){v(d,function(a){l+a>=b||(a=l+a,m(a,n(f(a))))})};p()},memoize:function(b,d,a){d=d||function(a){return a};var c={},e={},f=function(){function f(){var b=F(arguments);c[l]=b;var d=e[l]; | ||
delete e[l];for(var g=-1,h=d.length;++g<h;)d[g].apply(a,b)}var k=F(arguments),h=k.pop(),l=d.apply(null,k);if(c.hasOwnProperty(l))E(function(){h.apply(a,c[l])});else{if(e.hasOwnProperty(l))return e[l].push(h);e[l]=[h];k.push(f);b.apply(a,k)}};f.memo=c;f.unmemoized=b;return f},unmemoize:function(b){return function(){return(b.unmemoized||b).apply(null,arguments)}},log:T("log"),dir:T("dir"),createLogger:T,noConflict:function(){B.async=ia;return D}},fa={"function":!0,object:!0};fa[typeof module]&&module&& | ||
module.exports?module.exports=D:fa[typeof define]&&define&&define.amd?define([],function(){return D}):B.async=D}).call(this); |
{ | ||
"name": "neo-async", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"description": "Neo-Async is compatible with Async.js, it is faster and has more feature.", | ||
@@ -23,3 +23,2 @@ "main": "index.js", | ||
"coveralls": "^2.11.2", | ||
"espower-loader": "^0.10.0", | ||
"func-comparator": "^0.2.0", | ||
@@ -26,0 +25,0 @@ "intelli-espower-loader": "^0.5.0", |
@@ -12,3 +12,3 @@ # Neo-Async | ||
```html | ||
<script src="async.compact.js"></script> | ||
<script src="async.min.js"></script> | ||
``` | ||
@@ -18,3 +18,3 @@ | ||
```js | ||
require(['async.compact'], function(async) {}); | ||
require(['async.min'], function(async) {}); | ||
``` | ||
@@ -21,0 +21,0 @@ |
@@ -88,2 +88,51 @@ /* global describe, it */ | ||
it('should throw error', function(done) { | ||
var order = []; | ||
var collection = [1, 3, 2, 4]; | ||
var iterator = function(num, callback) { | ||
setTimeout(function() { | ||
order.push(num); | ||
callback(num === 3, num); | ||
}, num * 10); | ||
}; | ||
async.concat(collection, iterator, function(err, res) { | ||
assert.ok(err); | ||
assert.deepEqual(res, [1, 2, 3]); | ||
assert.deepEqual(order, [1, 2, 3]); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = {}; | ||
async.concat(array, concatIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = []; | ||
async.concat(object, concatIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -147,2 +196,52 @@ | ||
it('should throw error', function(done) { | ||
var order = []; | ||
var collection = [1, 3, 2, 4]; | ||
var iterator = function(num, callback) { | ||
setTimeout(function() { | ||
order.push(num); | ||
callback(num === 3, num); | ||
}, num * 10); | ||
}; | ||
async.concatSeries(collection, iterator, function(err, res) { | ||
assert.ok(err); | ||
assert.deepEqual(res, [1, 3]); | ||
assert.deepEqual(order, [1, 3]); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = {}; | ||
async.concatSeries(array, concatIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = []; | ||
async.concatSeries(object, concatIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -206,3 +305,52 @@ | ||
it('should throw error', function(done) { | ||
var order = []; | ||
var collection = [1, 3, 2, 4, 5]; | ||
var iterator = function(num, callback) { | ||
setTimeout(function() { | ||
order.push(num); | ||
callback(num === 3, num); | ||
}, num * 10); | ||
}; | ||
async.concatLimit(collection, 5, iterator, function(err, res) { | ||
assert.ok(err); | ||
assert.deepEqual(res, [1, 2, 3]); | ||
assert.deepEqual(order, [1, 2, 3]); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = {}; | ||
async.concatLimit(array, 2, concatIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = []; | ||
async.concatLimit(object, 2, concatIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -71,2 +71,39 @@ /* global describe, it */ | ||
}); | ||
it('should not get item', function(done) { | ||
var order = []; | ||
var collection = [2, 6, 4]; | ||
async.detect(collection, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, [2, 4, 6]); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.detect(array, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.detect(object, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -120,2 +157,39 @@ | ||
}); | ||
it('should not get item', function(done) { | ||
var order = []; | ||
var collection = [2, 6, 4]; | ||
async.detectSeries(collection, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, [2, 6, 4]); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.detectSeries(array, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.detectSeries(object, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -160,3 +234,3 @@ | ||
var collection = { | ||
a: 1.1, | ||
a: 2.1, | ||
b: 3.5, | ||
@@ -167,4 +241,4 @@ c: 2.7 | ||
async.detectLimit(collection, 2, detectIterator(order), function(res) { | ||
assert.strictEqual(res, 1.1); | ||
assert.deepEqual(order, [1]); | ||
assert.strictEqual(res, 2.7); | ||
assert.deepEqual(order, [2, 4, 3]); | ||
done(); | ||
@@ -175,3 +249,39 @@ }, Math); | ||
it('should not get item', function(done) { | ||
var order = []; | ||
var collection = [2, 6, 4]; | ||
async.detectLimit(collection, 2, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, [2, 6, 4]); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.detectLimit(array, 2, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.detectLimit(object, 2, detectIterator(order), function(res) { | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -79,3 +79,3 @@ /* global describe, it */ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -120,2 +120,30 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.each(array, eachIterator(order), function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.each(object, eachIterator(order), function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -178,3 +206,3 @@ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -219,2 +247,30 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.eachSeries(array, eachIterator(order), function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.eachSeries(object, eachIterator(order), function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -227,3 +283,3 @@ | ||
var order = []; | ||
var collection = [1, 3, 4, 2, 3, 1]; | ||
var collection = [1, 3, 4, 2, 3]; | ||
@@ -235,3 +291,3 @@ async.eachLimit(collection, 2, eachIterator(order), function(err) { | ||
assert.deepEqual(order, [1, 3, 2, 4, 1, 3]); | ||
assert.deepEqual(order, [1, 3, 2, 4, 3]); | ||
done(); | ||
@@ -279,3 +335,3 @@ }); | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -320,3 +376,30 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.eachLimit(array, 3, eachIterator(order), function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.eachLimit(object, 3, eachIterator(order), function(err) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -32,3 +32,3 @@ /* global describe, it */ | ||
async.every(collection, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [1, 2]); | ||
@@ -45,3 +45,3 @@ done(); | ||
async.every(collection, everyIterator(order), function(res) { | ||
assert.ok(res); | ||
assert.strictEqual(res, true); | ||
assert.deepEqual(order, [1, 1, 3, 5]); | ||
@@ -62,3 +62,3 @@ done(); | ||
async.every(collection, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [2]); | ||
@@ -80,3 +80,3 @@ done(); | ||
async.every(collection, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [1, 3, 4]); | ||
@@ -96,3 +96,3 @@ done(); | ||
async.everySeries(collection, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [1, 3, 2]); | ||
@@ -109,3 +109,3 @@ done(); | ||
async.everySeries(collection, everyIterator(order), function(res) { | ||
assert.ok(res); | ||
assert.strictEqual(res, true); | ||
assert.deepEqual(order, [1, 3, 1, 5]); | ||
@@ -126,3 +126,3 @@ done(); | ||
async.everySeries(collection, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [4]); | ||
@@ -144,3 +144,3 @@ done(); | ||
async.everySeries(collection, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [1, 4]); | ||
@@ -160,3 +160,3 @@ done(); | ||
async.everyLimit(collection, 3, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [1, 2]); | ||
@@ -173,3 +173,3 @@ done(); | ||
async.everyLimit(collection, 1, everyIterator(order), function(res) { | ||
assert.ok(res); | ||
assert.strictEqual(res, true); | ||
assert.deepEqual(order, [1, 3, 1, 5]); | ||
@@ -190,3 +190,3 @@ done(); | ||
async.everyLimit(collection, 2, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [3, 4]); | ||
@@ -208,3 +208,3 @@ done(); | ||
async.everyLimit(collection, 2, everyIterator(order), function(res) { | ||
assert.ok(!res); | ||
assert.strictEqual(res, false); | ||
assert.deepEqual(order, [1, 4]); | ||
@@ -211,0 +211,0 @@ done(); |
@@ -81,3 +81,3 @@ /* global describe, it */ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -102,2 +102,32 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.map(array, mapIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.map(object, mapIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -162,3 +192,3 @@ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -183,2 +213,33 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.mapSeries(array, mapIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.mapSeries(object, mapIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -191,3 +252,3 @@ | ||
var order = []; | ||
var collection = [1, 3, 4, 2, 3, 1]; | ||
var collection = [1, 3, 4, 2, 3]; | ||
@@ -198,4 +259,4 @@ async.mapLimit(collection, 2, mapIterator(order), function(err, res) { | ||
} | ||
assert.deepEqual(res, [2, 6, 8, 4, 6, 2]); | ||
assert.deepEqual(order, [1, 3, 2, 4, 1, 3]); | ||
assert.deepEqual(res, [2, 6, 8, 4, 6]); | ||
assert.deepEqual(order, [1, 3, 2, 4, 3]); | ||
done(); | ||
@@ -247,3 +308,3 @@ }); | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -268,4 +329,34 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.mapLimit(array, 3, mapIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.mapLimit(object, 2, mapIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -71,2 +71,27 @@ /* global describe, it */ | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.pick(array, pickIterator(order), function(res) { | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.pick(object, pickIterator(order), function(res) { | ||
assert.deepEqual(res, {}); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -120,2 +145,27 @@ | ||
}); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.pickSeries(array, pickIterator(order), function(res) { | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.pickSeries(object, pickIterator(order), function(res) { | ||
assert.deepEqual(res, {}); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -128,7 +178,7 @@ | ||
var order = []; | ||
var collection = [1, 3, 4, 2, 3, 1]; | ||
var collection = [1, 3, 4, 2, 3, 1, 3]; | ||
async.pickLimit(collection, 2, pickIterator(order), function(res) { | ||
assert.deepEqual(res, [1, 3, 3, 1]); | ||
assert.deepEqual(order, [1, 3, 2, 4, 1, 3]); | ||
assert.deepEqual(res, [1, 3, 3, 1, 3]); | ||
assert.deepEqual(order, [1, 3, 2, 4, 1, 3, 3]); | ||
done(); | ||
@@ -174,3 +224,27 @@ }); | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.pickLimit(array, 3, pickIterator(order), function(res) { | ||
assert.deepEqual(res, []); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.pickLimit(object, 2, pickIterator(order), function(res) { | ||
assert.deepEqual(res, {}); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -106,3 +106,3 @@ /* global describe, it */ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -127,2 +127,32 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.reduce(array, 0, reduceIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.strictEqual(res, 0); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.reduce(object, 0, reduceIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.strictEqual(res, 0); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -201,3 +231,3 @@ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -222,3 +252,33 @@ var order = []; | ||
it('should return response immediately if array is empty', function(done) { | ||
var order = []; | ||
var array = []; | ||
async.reduceRight(array, 0, reduceIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.strictEqual(res, 0); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
it('should return response immediately if object is empty', function(done) { | ||
var order = []; | ||
var object = {}; | ||
async.reduceRight(object, 0, reduceIterator(order), function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.strictEqual(res, 0); | ||
assert.deepEqual(order, []); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -81,3 +81,3 @@ /* global describe, it */ | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -159,3 +159,3 @@ var order = []; | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -236,3 +236,3 @@ var order = []; | ||
it('should cause error', function(done) { | ||
it('should throw error', function(done) { | ||
@@ -239,0 +239,0 @@ var order = []; |
@@ -79,2 +79,25 @@ /* global describe, it */ | ||
var order = []; | ||
var collection = [4, 3, 2]; | ||
var iterator = function(memo, num, index, callback) { | ||
setTimeout(function() { | ||
order.push(num); | ||
memo.push(num); | ||
callback(null, num !== 3); | ||
}, num * 10); | ||
}; | ||
async.transform(collection, iterator, function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.deepEqual(res, [2, 3]); | ||
assert.deepEqual(order, [2, 3]); | ||
done(); | ||
}); | ||
}); | ||
it('should execute iterator and break when callback is called "false"', function(done) { | ||
var order = []; | ||
var collection = { | ||
@@ -131,3 +154,3 @@ a: 5, | ||
assert.ok(err); | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(res, [1, 2, 3, 4]); | ||
assert.deepEqual(order, [1, 2, 3, 4]); | ||
@@ -261,3 +284,3 @@ done(); | ||
assert.ok(err); | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(res, [1, 5, 3, 2, 4]); | ||
assert.deepEqual(order, [1, 5, 3, 2, 4]); | ||
@@ -395,3 +418,3 @@ done(); | ||
assert.ok(err); | ||
assert.strictEqual(res, undefined); | ||
assert.deepEqual(res, [1, 3]); | ||
assert.deepEqual(order, [1, 3]); | ||
@@ -398,0 +421,0 @@ done(); |
Sorry, the diff of this file is not supported yet
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
222372
8
7425