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

neo-async

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neo-async - npm Package Compare versions

Comparing version 0.3.4 to 0.4.0

108

lib/async.js

@@ -97,3 +97,5 @@ (function() {

createLogger: createLogger,
noConflict: noConflict
noConflict: noConflict,
eventEmitter: eventEmitter,
EventEmitter: EventEmitter
};

@@ -1382,3 +1384,2 @@

}
iterate();

@@ -2587,3 +2588,3 @@

var iterate = function() {
_iterator(completed, once(createCallback(completed)));
_iterator(completed, createCallback(completed));
};

@@ -2595,4 +2596,10 @@

var called = false;
return function(err, res) {
if (called) {
throw new Error('Callback was already called.');
}
called = true;
result[index] = res;

@@ -2755,3 +2762,98 @@

function EventEmitter(emitter, limit) {
this._emitter = emitter || series;
this._limit = limit || 4;
this._events = {};
}
EventEmitter.prototype.on = function on(key, callback) {
var self = this;
if (typeof key == 'object') {
_objectEach(key, function(func, key) {
on.call(self, key, func);
});
} else {
self._events[key] = self._events[key] || [];
if (Array.isArray(callback)) {
Array.prototype.push.apply(self._events[key], callback);
} else {
self._events[key].push(callback);
}
}
return self;
};
EventEmitter.prototype.once = function once(key, callback) {
var self = this;
if (typeof key == 'object') {
_objectEach(key, function(func, key) {
once.call(self, key, func);
});
} else {
if (Array.isArray(callback)) {
_arrayEvery(callback, function(func) {
func._once = true;
});
} else {
callback._once = true;
}
self.on(key, callback);
}
return self;
};
EventEmitter.prototype.emit = function(key, callback, thisArg) {
callback = callback || function() {};
var events = this._events[key] || [];
if (!events.length) {
return callback();
}
var emitter = this._emitter;
emitter = thisArg ? emitter.bind(thisArg) : emitter;
if (emitter === parallelLimit) {
emitter(events, this._limit, done);
} else {
emitter(events, done);
}
return this;
function done(err, res) {
var l = events.length;
while(--l) {
var fn = events[l];
if (fn._once) {
events.splice(l, 1);
}
}
callback(err, res);
}
};
/**
* @param {Object} option
* @param {Boolean} option.series - default
* @param {Boolean} option.parallel
* @param {Boolean} option.parallelLimit
* @param {Number} option.limit - default 4
*/
function eventEmitter(option) {
option = option || {};
var limit = option.limit;
if (option.parallel && !limit) {
return new EventEmitter(parallel);
}
if (option.parallel || option.parallelLimit) {
return new EventEmitter(parallelLimit, limit);
}
return new EventEmitter(option.emitter);
}
}.call(this));

82

lib/async.min.js

@@ -1,40 +0,42 @@

(function(){function t(b){for(var d=Object.keys(b),a=-1,c=d.length,e=Array(c);++a<c;)e[a]=b[d[a]];return e}function D(b){for(var d=-1,a=b.length,c=Array(a);++d<a;)c[d]=b[d];return c}function u(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 s(b,d){for(var a=-1,c=b.length;++a<c;)d(b[a],a,b);return b}function x(b,d,a){a=a||Object.keys(b);for(var c=-1,e=a.length;++c<e;){var f=
a[c];d(b[f],f,b)}return b}function ha(b,d){return Array.isArray(b)?s(b,d):x(b,d)}function r(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 v(b){for(var d=b.length,a=-1,c=Array(d);++a<d;)c[a]=b[a];return c}function y(b){for(var d=Object.keys(b),a=d.length,c=-1,e={};++c<a;){var f=d[c];e[f]=b[f]}return e}function R(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(a,c){if(d){if(a)return b(a,
c);throw Error("Callback was already called.");}d=!0;b(a,c)}}function F(b,d,a,c){function e(b,c){b?(a(b),a=function(){}):!1===c?(a(),a=function(){}):++g>=f&&(a(),a=function(){})}a=a||function(){};var f,g=0,k=c?d.bind(c):d;d=function(a){k(a,p(e))};if(Array.isArray(b)){f=b.length;if(!f)return a();s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a();x(b,d,c)}}function G(b,d,a,c){function e(b,c){if(k)throw Error("Callback was already called.");k=!0;if(b)return a(b);if(++h>=f||!1===c)return a();g()}
a=a||function(){};var f,g,k,h=0,l=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;if(!f)return a();g=function(){k=!1;l(b[h],e)}}else{var m=Object.keys(b);f=m.length;if(!f)return a();g=function(){k=!1;l(b[m[h]],e)}}g()}function S(b,d,a,c,e){function f(a,b){a?(c(a),c=function(){}):++h>=g?(c(),c=function(){}):!1===b?(c(),c=function(){}):h>=l+d&&(l=h,k())}c=c||function(){};var g,k,h=0,l=0,m=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c();k=function(){r(d,function(a){l+a>=g||m(b[l+a],p(f))})}}else{var n=
Object.keys(b);g=n.length;if(!g)return c();k=function(){r(d,function(a){l+a>=g||m(b[n[l+a]],p(f))})}}k()}function T(b,d,a,c){function e(b){var c=!1;return function(d,e){if(c)throw Error("Callback was already called.");c=!0;g[b]=e;d?(a(d,v(g)),a=function(){}):++h>=f&&(a(null,g),a=function(){})}}a=a||function(){};var f,g,k=0,h=0,l=c?d.bind(c):d;d=function(a){l(a,e(k++))};if(Array.isArray(b)){f=b.length;g=Array(f);if(!f)return a(null,g);s(b,d)}else{c=Object.keys(b);f=c.length;g=Array(f);if(!f)return a(null,
g);x(b,d,c)}}function U(b,d,a,c){function e(b){var c=!1;return function(d,e){if(c)throw Error("Callback was already called.");c=!0;g[b]=e;d?(a(d,v(g)),a=function(){}):++h>=f?(a(null,g),a=function(){}):k()}}a=a||function(){};var f,g,k,h=0,l=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;g=Array(f);if(!f)return a(null,g);k=function(){l(b[h],e(h))}}else{var m=Object.keys(b);f=m.length;g=Array(f);if(!f)return a(null,g);k=function(){l(b[m[h]],e(h))}}k()}function W(b,d,a,c,e){function f(a){var b=!1;return function(e,
f){if(b)throw Error("Callback was already called.");b=!0;k[a]=f;e?(c(e,v(k)),c=function(){}):++l>=g?(c(null,k),c=function(){}):l>=m+d&&(m=l,h())}}c=c||function(){};var g,k,h,l=0,m=0,n=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;k=Array(g);if(!g)return c(null,k);h=function(){r(d,function(a){m+a>=g||(a=m+a,n(b[a],f(a)))})}}else{var q=Object.keys(b);g=q.length;k=Array(g);if(!g)return c(null,k);h=function(){r(d,function(a){m+a>=g||(a=m+a,n(b[q[a]],f(a)))})}}h()}function X(b,d,a,c){H(b,d,function(c){a=
a||function(){};a(Array.isArray(b)?c:t(c))},c)}function Y(b,d,a,c){I(b,d,function(c){a=a||function(){};a(Array.isArray(b)?c:t(c))},c)}function Z(b,d,a,c,e){J(b,d,a,function(a){c=c||function(){};c(Array.isArray(b)?a:t(a))},e)}function K(b,d,a,c,e){a=a||function(){};var f,g=0,k=function(){function b(c){return function(b){b?++g>=f&&(a(),a=function(){}):(a(c),a=function(){})}}function c(b){return function(c){c?(a(b),a=function(){}):++g>=f&&(a(),a=function(){})}}return e?b:c}(),h=c?d.bind(c):d;d=function(a){h(a,
k(a))};if(Array.isArray(b)){f=b.length;if(!f)return a();s(b,d)}else{f=Object.keys(b).length;if(!f)return a();x(b,d)}}function L(b,d,a,c,e){a=a||function(){};var f,g,k,h=0,l=function(){function b(c){return function(b){if(k)throw Error("Callback was already called.");k=!0;if(!b)return a(c);if(++h>=f)return a();g()}}function c(b){return function(c){if(k)throw Error("Callback was already called.");k=!0;if(c)return a(b);if(++h>=f)return a();g()}}return e?b:c}(),m=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;
if(!f)return a();g=function(){k=!1;var a=b[h];m(a,l(a))}}else{var n=Object.keys(b);f=n.length;if(!f)return a();g=function(){k=!1;var a=b[n[h]];m(a,l(a))}}g()}function M(b,d,a,c,e,f){c=c||function(){};var g,k,h=0,l=0,m=function(){function a(b){return function(a){a?++h>=g?(c(),c=function(){}):h>=l+d&&(l=h,k()):(c(b),c=function(){})}}function b(a){return function(b){b?(c(a),c=function(){}):++h>=g?(c(),c=function(){}):h>=l+d&&(l=h,k())}}return f?a:b}(),n=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;
if(!g)return c();k=function(){r(d,function(a){l+a>=g||(a=b[l+a],n(a,p(m(a))))})}}else{var q=Object.keys(b);g=q.length;if(!g)return c();k=function(){r(d,function(a){l+a>=g||(a=b[q[l+a]],n(a,p(m(a))))})}}k()}function H(b,d,a,c,e){a=a||function(){};var f,g=Array.isArray(b),k={},h=0,l=function(){function b(c,d){var e=!1;return function(b){if(e)throw Error("Callback was already called.");e=!0;b||(k[c+""]=d);++h>=f&&a(g?t(k):k)}}function c(b,d){var e=!1;return function(c){if(e)throw Error("Callback was already called.");
e=!0;c&&(k[b+""]=d);++h>=f&&a(g?t(k):k)}}return e?b:c}(),m=c?d.bind(c):d;d=function(a,b){m(a,l(b,a))};if(g){f=b.length;if(!f)return a([]);s(b,d)}else{f=Object.keys(b).length;if(!f)return a({});x(b,d)}}function I(b,d,a,c,e){a=a||function(){};var f,g,k=Array.isArray(b),h={},l=0,m=function(){function b(c,d){var e=!1;return function(b){if(e)throw Error("Callback was already called.");e=!0;b||(h[c+""]=d);if(++l>=f)return a(k?t(h):h);g()}}function c(b,d){var e=!1;return function(c){if(e)throw Error("Callback was already called.");
e=!0;c&&(h[b+""]=d);if(++l>=f)return a(k?t(h):h);g()}}return e?b:c}(),n=c?d.bind(c):d;if(k){f=b.length;if(!f)return a([]);g=function(){var a=b[l];n(a,m(l,a))}}else{var q=Object.keys(b);f=q.length;if(!f)return a({});g=function(){var a=q[l],c=b[a];n(c,m(a,c))}}g()}function J(b,d,a,c,e,f){c=c||function(){};var g,k,h=Array.isArray(b),l={},m=0,n=0,q=function(){function a(b,e){return function(a){a||(l[b+""]=e);if(++m>=g)return c(h?t(l):l);m>=n+d&&(n=m,k())}}function b(a,e){return function(b){b&&(l[a+""]=
e);if(++m>=g)return c(h?t(l):l);m>=n+d&&(n=m,k())}}return f?a:b}(),z=e?a.bind(e):a;if(h){g=b.length;if(!g)return c([]);k=function(){r(d,function(a){if(!(n+a>=g)){a=n+a;var c=b[a];z(c,p(q(a,c)))}})}}else{var V=Object.keys(b);g=V.length;if(!g)return c({});k=function(){r(d,function(a){if(!(n+a>=g)){a=V[n+a];var c=b[a];z(c,p(q(a,c)))}})}}k()}function N(b,d,a,c,e){function f(a,b){if(h)throw Error("Callback was already called.");h=!0;if(a)return c(a);if(++l>=g)return c(null,b);k(b)}c=c||function(){};var g,
k,h,l=0,m=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[l],f)}}else{var n=Object.keys(b);g=n.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[n[l]],f)}}k(d)}function $(b,d,a,c){function e(b,c){b?(a(b,g?v(k):y(k)),a=function(){}):!1===c?(a(null,g?v(k):y(k)),a=function(){}):++h>=f&&(a(null,k),a=function(){})}a=a||function(){};var f,g=Array.isArray(b),k=g?[]:{},h=0,l=c?d.bind(c):d;d=function(a,b){l(k,a,b,p(e))};if(g){f=b.length;if(!f)return a(null,
k);s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a(null,k);x(b,d,c)}}function aa(b,d,a,c){function e(b,c){if(k)throw Error("Callback was already called.");k=!0;if(b)return a(b,l);if(!1===c||++m>=f)return a(null,l);g()}a=a||function(){};var f,g,k,h=Array.isArray(b),l=h?[]:{},m=0,n=c?d.bind(c):d;if(h){f=b.length;if(!f)return a(null,l);g=function(){k=!1;n(l,b[m],m,e)}}else{var q=Object.keys(b);f=q.length;if(!f)return a(null,l);g=function(){k=!1;var a=q[m];n(l,b[a],a,e)}}g()}function ba(b,d,a,
c,e){function f(a,b){a?(c(a,h?v(l):y(l)),c=function(){}):!1===b?(c(null,h?v(l):y(l)),c=function(){}):++m>=g?(c(null,l),c=function(){}):m>=n+d&&(n=m,k())}c=c||function(){};var g,k,h=Array.isArray(b),l=h?[]:{},m=0,n=0,q=e?a.bind(e):a;if(h){g=b.length;if(!g)return c(null,l);k=function(){r(d,function(a){n+a>=g||(a=n+a,q(l,b[a],a,p(f)))})}}else{var z=Object.keys(b);g=z.length;if(!g)return c(null,l);k=function(){r(d,function(a){n+a>=g||(a=z[n+a],q(l,b[a],a,p(f)))})}}k()}function O(b){function d(a,b,d,h){b=
c(b,h);U(a,b,e(d))}function a(a,b,d,h,l){d=c(d,l);W(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,R(d,"item"))}}switch(b){case "series":return d;case "limit":return a;default:return function(a,b,d,h){b=c(b,h);T(a,b,e(d))}}}function P(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=D(arguments),c=a.pop();N(b,a,function(a,b,c){a.push(function(a){var b=u(arguments,1);c(a,b)});b.apply(d,a)},function(a,b){b=Array.isArray(b)?b:[b];b.unshift(a);c.apply(d,b)})}}function da(b){var d="series"===b?G:F;return function(a){var b=this,e=u(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=Array.isArray(a)?a:[a];a&&d.length?(e.started=!0,c="function"==
typeof c?c:null,s(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});"function"==typeof e.saturated&&e.length()>=e.concurrency&&e.saturated();w(e.process)})):e.idle()&&"function"==typeof e.drain&&w(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);"function"==typeof e.drain&&e.idle()&&e.drain();e.process()}if(!(e.paused||f>=e.concurrency)&&e.length()){var b=e.tasks.shift();"function"!=typeof 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,r(e.concurrency,function(){A.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 Q(b){function d(a){var c=u(arguments,1);console&&(a?console.error&&console.error(a):console[b]&&s(c,console[b]))}return function(a){var b=u(arguments,1);b.push(d);a.apply(null,b)}}var E=this,ja=E&&E.async,B={"function":!0,object:!0},C,w;(function(){B[typeof process]&&
process.nextTick?(C=process.nextTick,w=B[typeof setImmediate]?function(b){setImmediate(b)}:C):w=C=B[typeof setImmediate]?function(b){setImmediate(b)}:function(b){setTimeout(b,0)}})();var A={VERSION:require("../package.json").version,each:F,eachSeries:G,eachLimit:S,forEach:F,forEachSeries:G,forEachLimit:S,map:T,mapSeries:U,mapLimit:W,filter:X,filterSeries:Y,filterLimit:Z,select:X,selectSeries:Y,selectLimit:Z,reject:function(b,d,a,c){H(b,d,a,c,!0)},rejectSeries:function(b,d,a,c){I(b,d,a,c,!0)},rejectLimit:function(b,
d,a,c,e){J(b,d,a,c,e,!0)},detect:K,detectSeries:L,detectLimit:M,pick:H,pickSeries:I,pickLimit:J,reduce:N,reduceRight:function(b,d,a,c,e){function f(a,b){if(h)throw Error("Callback was already called.");h=!0;if(a)return c(a);if(++l>=g)return c(null,b);k(b)}c=c||function(){};var g,k,h,l=0,m=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[g-l-1],f)}}else{var n=Object.keys(b);g=n.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[n[g-l-1]],f)}}k(d)},transform:$,
transformSeries:aa,transformLimit:ba,sortBy:O(),sortBySeries:O("series"),sortByLimit:O("limit"),some:function(b,d,a,c){K(b,d,function(b){a(!!b)},c)},someSeries:function(b,d,a,c){L(b,d,function(b){a(!!b)},c)},someLimit:function(b,d,a,c,e){M(b,d,a,function(a){c(!!a)},e)},every:function(b,d,a,c){K(b,d,function(b){a=a||function(){};a(!b)},c,!0)},everySeries:function(b,d,a,c){L(b,d,function(b){a=a||function(){};a(!b)},c,!0)},everyLimit:function(b,d,a,c,e){M(b,d,a,function(a){c=c||function(){};c(!a)},e,
!0)},concat:function(b,d,a,c){function e(b,c){c&&Array.prototype.push.apply(g,Array.isArray(c)?c:[c]);b?(a(b,v(g)),a=function(){}):++k>=f&&(a(null,g),a=function(){})}a=a||function(){};var f,g=[],k=0,h=c?d.bind(c):d;d=function(a){h(a,p(e))};if(Array.isArray(b)){f=b.length;if(!f)return a(null,g);s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a(null,g);x(b,d,c)}},concatSeries:function(b,d,a,c){function e(b,c){if(k)throw Error("Callback was already called.");k=!0;c&&Array.prototype.push.apply(h,
Array.isArray(c)?c:[c]);if(b)return a(b,h);if(++l>=f)return a(null,h);g()}a=a||function(){};var f,g,k,h=[],l=0,m=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;if(!f)return a(null,h);g=function(){k=!1;m(b[l],e)}}else{var n=Object.keys(b);f=n.length;if(!f)return a(null,h);g=function(){k=!1;m(b[n[l]],e)}}g()},concatLimit:function(b,d,a,c,e){function f(a,b){b&&Array.prototype.push.apply(h,Array.isArray(b)?b:[b]);a?(c(a,h),c=function(){}):++l>=g?(c(null,h),c=function(){}):l>=m+d&&(m=l,k())}c=c||function(){};
var g,k,h=[],l=0,m=0,n=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c(null,h);k=function(){r(d,function(a){m+a>=g||n(b[m+a],p(f))})}}else{var q=Object.keys(b);g=q.length;if(!g)return c(null,h);k=function(){r(d,function(a){m+a>=g||n(b[q[m+a]],p(f))})}}k()},multiEach:function(b,d,a){function c(c){c?(a(c),a=function(){}):k>=g&&l&&(a(null,b),a=function(){})}function e(a){var b=f[a];return function(d,f){if(d)return c(d);var p=e(a+1);b&&"object"==typeof f&&ha(f,function(a,d){if(a===h)return l=
!0,c();g++;b(a,d,p)});if(a)return k++,c()}}a=a||function(){};var f=Array.isArray(d)?d:t(d);if(!d||!f.length)return a(null,b);var g=0,k=0,h={},l=!1;d=Array.isArray(b)?v(b):t(b);d.push(h);e(0)(null,d)},parallel:function(b,d,a){var c=P(a);$(b,c,d,a)},series:function(b,d,a){var c=P(a);aa(b,c,d,a)},parallelLimit:function(b,d,a,c){var e=P(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=u(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=u(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)}}}();N(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=u(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=u(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,ga(arguments))},seq:ca,applyEach:da(),applyEachSeries:da("series"),
queue:function(b,d,a){function c(a,b,c){var d=Array.isArray(a)?a:[a];a&&d.length?(e.started=!0,b="function"==typeof b?b:null,s(d,function(a){a={task:a,callback:b};c?e.tasks.unshift(a):e.tasks.push(a);"function"==typeof e.saturated&&e.length()>=e.concurrency&&e.saturated();w(e.process)})):e.idle()&&"function"==typeof e.drain&&w(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=Array.isArray(b)?b:[b];c="function"==typeof c?c:null;s(b,function(b){a.tasks.push({data:b,callback:c});a.drained=!1;"function"==typeof a.saturated&&a.length()===a.payload&&a.saturated()});w(a.process)},process:function(){if(!c)if(a.length()){var e="number"==typeof a.payload?a.tasks.splice(0,d):a.tasks,f=R(e,"data");a.length()||"function"!=typeof a.empty||a.empty();c=!0;b(f,function(){c=!1;var b=arguments;s(e,function(a){a.callback&&a.callback.apply(null,
b)});a.process()})}else"function"!=typeof 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--;s(g.slice(0),function(a){a()})}d=d?p(d):function(){};var e=Object.keys(b),f=e.length;if(!f)return d();var g=[],k={};a(function(){f||d(null,k)});x(b,function(b,e){function f(a){var b=u(arguments,1);1>=b.length&&(b=b[0]);if(a){var g=y(k);g[e]=b;return d(a,g)}k[e]=b;w(c)}
function n(){return!k.hasOwnProperty(e)&&ia(r,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);s(f,k)}}b=Array.isArray(b)?b:[b];var p=b.length,r=b.slice(0,p-1),s=b[p-1];if(n())return s(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)})}"function"==typeof b&&(a=d,d=b,b=5);
b=parseInt(b,10)||5;return"function"==typeof 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=[];Array.isArray(b)?a=b.length:(c=Object.keys(b),a=c.length);return d(0)},apply:function(b){var d=u(arguments,1);return function(){b.apply(null,Array.prototype.concat.apply(d,D(arguments)))}},nextTick:C,setImmediate:w,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;r(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(){r(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=D(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=D(arguments),h=k.pop(),l=d.apply(null,k);if(c.hasOwnProperty(l))C(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:Q("log"),dir:Q("dir"),createLogger:Q,
noConflict:function(){E.async=ja;return A}};B[typeof module]&&module&&module.exports?module.exports=A:B[typeof define]&&define&&define.amd?define([],function(){return A}):E.async=A}).call(this);
(function(){function t(b){for(var d=Object.keys(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 u(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 la(b){for(var d=-1,a=b.length,c=Array(a);++d<a;)c[a-d-1]=b[d];return c}function s(b,d){for(var a=-1,c=b.length;++a<c;)d(b[a],a,b);return b}function v(b,d,a){a=a||Object.keys(b);for(var c=-1,e=a.length;++c<e;){var f=
a[c];d(b[f],f,b)}return b}function ma(b,d){return Array.isArray(b)?s(b,d):v(b,d)}function r(b,d){for(var a=-1;++a<b;)d(a)}function T(b,d){for(var a=b.length,c=-1;++c<a;)if(!d(b[c]))return!1;return!0}function w(b){for(var d=b.length,a=-1,c=Array(d);++a<d;)c[a]=b[a];return c}function z(b){for(var d=Object.keys(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 q(b){var d=!1;return function(a,c){if(d){if(a)return b(a,
c);throw Error("Callback was already called.");}d=!0;b(a,c)}}function G(b,d,a,c){function e(b,c){b?(a(b),a=function(){}):!1===c?(a(),a=function(){}):++g>=f&&(a(),a=function(){})}a=a||function(){};var f,g=0,k=c?d.bind(c):d;d=function(a){k(a,q(e))};if(Array.isArray(b)){f=b.length;if(!f)return a();s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a();v(b,d,c)}}function H(b,d,a,c){function e(b,c){if(k)throw Error("Callback was already called.");k=!0;if(b)return a(b);if(++h>=f||!1===c)return a();g()}
a=a||function(){};var f,g,k,h=0,l=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;if(!f)return a();g=function(){k=!1;l(b[h],e)}}else{var m=Object.keys(b);f=m.length;if(!f)return a();g=function(){k=!1;l(b[m[h]],e)}}g()}function V(b,d,a,c,e){function f(a,b){a?(c(a),c=function(){}):++h>=g?(c(),c=function(){}):!1===b?(c(),c=function(){}):h>=l+d&&(l=h,k())}c=c||function(){};var g,k,h=0,l=0,m=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c();k=function(){r(d,function(a){l+a>=g||m(b[l+a],q(f))})}}else{var n=
Object.keys(b);g=n.length;if(!g)return c();k=function(){r(d,function(a){l+a>=g||m(b[n[l+a]],q(f))})}}k()}function W(b,d,a,c){function e(b){var c=!1;return function(e,d){if(c)throw Error("Callback was already called.");c=!0;g[b]=d;e?(a(e,w(g)),a=function(){}):++h>=f&&(a(null,g),a=function(){})}}a=a||function(){};var f,g,k=0,h=0,l=c?d.bind(c):d;d=function(a){l(a,e(k++))};if(Array.isArray(b)){f=b.length;g=Array(f);if(!f)return a(null,g);s(b,d)}else{c=Object.keys(b);f=c.length;g=Array(f);if(!f)return a(null,
g);v(b,d,c)}}function X(b,d,a,c){function e(b){var c=!1;return function(e,d){if(c)throw Error("Callback was already called.");c=!0;g[b]=d;e?(a(e,w(g)),a=function(){}):++h>=f?(a(null,g),a=function(){}):k()}}a=a||function(){};var f,g,k,h=0,l=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;g=Array(f);if(!f)return a(null,g);k=function(){l(b[h],e(h))}}else{var m=Object.keys(b);f=m.length;g=Array(f);if(!f)return a(null,g);k=function(){l(b[m[h]],e(h))}}k()}function Z(b,d,a,c,e){function f(a){var b=!1;return function(e,
f){if(b)throw Error("Callback was already called.");b=!0;k[a]=f;e?(c(e,w(k)),c=function(){}):++l>=g?(c(null,k),c=function(){}):l>=m+d&&(m=l,h())}}c=c||function(){};var g,k,h,l=0,m=0,n=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;k=Array(g);if(!g)return c(null,k);h=function(){r(d,function(a){m+a>=g||(a=m+a,n(b[a],f(a)))})}}else{var p=Object.keys(b);g=p.length;k=Array(g);if(!g)return c(null,k);h=function(){r(d,function(a){m+a>=g||(a=m+a,n(b[p[a]],f(a)))})}}h()}function $(b,d,a,c){I(b,d,function(c){a=
a||function(){};a(Array.isArray(b)?c:t(c))},c)}function aa(b,d,a,c){J(b,d,function(c){a=a||function(){};a(Array.isArray(b)?c:t(c))},c)}function ba(b,d,a,c,e){K(b,d,a,function(a){c=c||function(){};c(Array.isArray(b)?a:t(a))},e)}function L(b,d,a,c,e){a=a||function(){};var f,g=0,k=function(){function b(c){return function(b){b?++g>=f&&(a(),a=function(){}):(a(c),a=function(){})}}function c(b){return function(c){c?(a(b),a=function(){}):++g>=f&&(a(),a=function(){})}}return e?b:c}(),h=c?d.bind(c):d;d=function(a){h(a,
k(a))};if(Array.isArray(b)){f=b.length;if(!f)return a();s(b,d)}else{f=Object.keys(b).length;if(!f)return a();v(b,d)}}function M(b,d,a,c,e){a=a||function(){};var f,g,k,h=0,l=function(){function b(c){return function(b){if(k)throw Error("Callback was already called.");k=!0;if(!b)return a(c);if(++h>=f)return a();g()}}function c(b){return function(c){if(k)throw Error("Callback was already called.");k=!0;if(c)return a(b);if(++h>=f)return a();g()}}return e?b:c}(),m=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;
if(!f)return a();g=function(){k=!1;var a=b[h];m(a,l(a))}}else{var n=Object.keys(b);f=n.length;if(!f)return a();g=function(){k=!1;var a=b[n[h]];m(a,l(a))}}g()}function N(b,d,a,c,e,f){c=c||function(){};var g,k,h=0,l=0,m=function(){function a(b){return function(a){a?++h>=g?(c(),c=function(){}):h>=l+d&&(l=h,k()):(c(b),c=function(){})}}function b(a){return function(b){b?(c(a),c=function(){}):++h>=g?(c(),c=function(){}):h>=l+d&&(l=h,k())}}return f?a:b}(),n=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;
if(!g)return c();k=function(){r(d,function(a){l+a>=g||(a=b[l+a],n(a,q(m(a))))})}}else{var p=Object.keys(b);g=p.length;if(!g)return c();k=function(){r(d,function(a){l+a>=g||(a=b[p[l+a]],n(a,q(m(a))))})}}k()}function I(b,d,a,c,e){a=a||function(){};var f,g=Array.isArray(b),k={},h=0,l=function(){function b(c,e){var d=!1;return function(b){if(d)throw Error("Callback was already called.");d=!0;b||(k[c+""]=e);++h>=f&&a(g?t(k):k)}}function c(b,d){var e=!1;return function(c){if(e)throw Error("Callback was already called.");
e=!0;c&&(k[b+""]=d);++h>=f&&a(g?t(k):k)}}return e?b:c}(),m=c?d.bind(c):d;d=function(a,b){m(a,l(b,a))};if(g){f=b.length;if(!f)return a([]);s(b,d)}else{f=Object.keys(b).length;if(!f)return a({});v(b,d)}}function J(b,d,a,c,e){a=a||function(){};var f,g,k=Array.isArray(b),h={},l=0,m=function(){function b(c,e){var d=!1;return function(b){if(d)throw Error("Callback was already called.");d=!0;b||(h[c+""]=e);if(++l>=f)return a(k?t(h):h);g()}}function c(b,d){var e=!1;return function(c){if(e)throw Error("Callback was already called.");
e=!0;c&&(h[b+""]=d);if(++l>=f)return a(k?t(h):h);g()}}return e?b:c}(),n=c?d.bind(c):d;if(k){f=b.length;if(!f)return a([]);g=function(){var a=b[l];n(a,m(l,a))}}else{var p=Object.keys(b);f=p.length;if(!f)return a({});g=function(){var a=p[l],c=b[a];n(c,m(a,c))}}g()}function K(b,d,a,c,e,f){c=c||function(){};var g,k,h=Array.isArray(b),l={},m=0,n=0,p=function(){function a(b,e){return function(a){a||(l[b+""]=e);if(++m>=g)return c(h?t(l):l);m>=n+d&&(n=m,k())}}function b(a,e){return function(b){b&&(l[a+""]=
e);if(++m>=g)return c(h?t(l):l);m>=n+d&&(n=m,k())}}return f?a:b}(),A=e?a.bind(e):a;if(h){g=b.length;if(!g)return c([]);k=function(){r(d,function(a){if(!(n+a>=g)){a=n+a;var c=b[a];A(c,q(p(a,c)))}})}}else{var Y=Object.keys(b);g=Y.length;if(!g)return c({});k=function(){r(d,function(a){if(!(n+a>=g)){a=Y[n+a];var c=b[a];A(c,q(p(a,c)))}})}}k()}function O(b,d,a,c,e){function f(a,b){if(h)throw Error("Callback was already called.");h=!0;if(a)return c(a);if(++l>=g)return c(null,b);k(b)}c=c||function(){};var g,
k,h,l=0,m=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[l],f)}}else{var n=Object.keys(b);g=n.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[n[l]],f)}}k(d)}function ca(b,d,a,c){function e(b,c){b?(a(b,g?w(k):z(k)),a=function(){}):!1===c?(a(null,g?w(k):z(k)),a=function(){}):++h>=f&&(a(null,k),a=function(){})}a=a||function(){};var f,g=Array.isArray(b),k=g?[]:{},h=0,l=c?d.bind(c):d;d=function(a,b){l(k,a,b,q(e))};if(g){f=b.length;if(!f)return a(null,
k);s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a(null,k);v(b,d,c)}}function da(b,d,a,c){function e(b,c){if(k)throw Error("Callback was already called.");k=!0;if(b)return a(b,l);if(!1===c||++m>=f)return a(null,l);g()}a=a||function(){};var f,g,k,h=Array.isArray(b),l=h?[]:{},m=0,n=c?d.bind(c):d;if(h){f=b.length;if(!f)return a(null,l);g=function(){k=!1;n(l,b[m],m,e)}}else{var p=Object.keys(b);f=p.length;if(!f)return a(null,l);g=function(){k=!1;var a=p[m];n(l,b[a],a,e)}}g()}function ea(b,d,a,
c,e){function f(a,b){a?(c(a,h?w(l):z(l)),c=function(){}):!1===b?(c(null,h?w(l):z(l)),c=function(){}):++m>=g?(c(null,l),c=function(){}):m>=n+d&&(n=m,k())}c=c||function(){};var g,k,h=Array.isArray(b),l=h?[]:{},m=0,n=0,p=e?a.bind(e):a;if(h){g=b.length;if(!g)return c(null,l);k=function(){r(d,function(a){n+a>=g||(a=n+a,p(l,b[a],a,q(f)))})}}else{var A=Object.keys(b);g=A.length;if(!g)return c(null,l);k=function(){r(d,function(a){n+a>=g||(a=A[n+a],p(l,b[a],a,q(f)))})}}k()}function P(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);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);W(a,b,e(d))}}}function Q(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 fa(b,d,a){var c=Q(a);ca(b,c,d,a)}function ga(b,d,a){var c=Q(a);da(b,c,d,a)}function R(b,d,a,c){var e=Q(c);ea(b,d,e,a,c)}function ha(){var b=arguments;return function(){var d=this,a=E(arguments),c=a.pop();O(b,a,function(a,b,c){a.push(function(a){var b=u(arguments,1);c(a,b)});b.apply(d,a)},function(a,b){b=Array.isArray(b)?b:[b];b.unshift(a);c.apply(d,b)})}}function ia(b){var d="series"===b?H:G;return function(a){var b=this,e=u(arguments,1),f=e.pop()||function(){};d(a,function(a,
d){a.apply(b,e.concat(d))},f)}}function ja(b,d,a){function c(a,b,c){var d=Array.isArray(a)?a:[a];a&&d.length?(e.started=!0,c="function"==typeof c?c:null,s(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});"function"==typeof e.saturated&&e.length()>=e.concurrency&&e.saturated();x(e.process)})):e.idle()&&"function"==typeof e.drain&&x(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);"function"==typeof e.drain&&e.idle()&&e.drain();e.process()}if(!(e.paused||f>=e.concurrency)&&e.length()){var b=e.tasks.shift();"function"!=typeof e.empty||e.length()||e.empty();f++;(e._thisArg?e._worker.bind(e._thisArg):e._worker)(b.task,q(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,r(e.concurrency,function(){B.setImmediate(e.process)}))},_worker:b,_thisArg:a},f=0;return e}function ka(b,d,a,c){function e(c){var d=!1;return function(m,n){if(d)throw Error("Callback was already called.");d=!0;f[c]=n;if(m)return a(m);if(++g>=b)return a(null,f);k(g,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,e(g))}function S(b){function d(a){var c=u(arguments,1);console&&(a?console.error&&
console.error(a):console[b]&&s(c,console[b]))}return function(a){var b=u(arguments,1);b.push(d);a.apply(null,b)}}function y(b,d){this._emitter=b||ga;this._limit=d||4;this._events={}}var F=this,na=F&&F.async,C={"function":!0,object:!0},D,x;(function(){C[typeof process]&&process.nextTick?(D=process.nextTick,x=C[typeof setImmediate]?function(b){setImmediate(b)}:D):x=D=C[typeof setImmediate]?function(b){setImmediate(b)}:function(b){setTimeout(b,0)}})();var B={VERSION:require("../package.json").version,
each:G,eachSeries:H,eachLimit:V,forEach:G,forEachSeries:H,forEachLimit:V,map:W,mapSeries:X,mapLimit:Z,filter:$,filterSeries:aa,filterLimit:ba,select:$,selectSeries:aa,selectLimit:ba,reject:function(b,d,a,c){I(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:L,detectSeries:M,detectLimit:N,pick:I,pickSeries:J,pickLimit:K,reduce:O,reduceRight:function(b,d,a,c,e){function f(a,b){if(h)throw Error("Callback was already called.");h=!0;if(a)return c(a);
if(++l>=g)return c(null,b);k(b)}c=c||function(){};var g,k,h,l=0,m=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[g-l-1],f)}}else{var n=Object.keys(b);g=n.length;if(!g)return c(null,d);k=function(a){h=!1;m(a,b[n[g-l-1]],f)}}k(d)},transform:ca,transformSeries:da,transformLimit:ea,sortBy:P(),sortBySeries:P("series"),sortByLimit:P("limit"),some:function(b,d,a,c){L(b,d,function(b){a(!!b)},c)},someSeries:function(b,d,a,c){M(b,d,function(b){a(!!b)},c)},someLimit:function(b,
d,a,c,e){N(b,d,a,function(a){c(!!a)},e)},every:function(b,d,a,c){L(b,d,function(b){a=a||function(){};a(!b)},c,!0)},everySeries:function(b,d,a,c){M(b,d,function(b){a=a||function(){};a(!b)},c,!0)},everyLimit:function(b,d,a,c,e){N(b,d,a,function(a){c=c||function(){};c(!a)},e,!0)},concat:function(b,d,a,c){function e(b,c){c&&Array.prototype.push.apply(g,Array.isArray(c)?c:[c]);b?(a(b,w(g)),a=function(){}):++k>=f&&(a(null,g),a=function(){})}a=a||function(){};var f,g=[],k=0,h=c?d.bind(c):d;d=function(a){h(a,
q(e))};if(Array.isArray(b)){f=b.length;if(!f)return a(null,g);s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a(null,g);v(b,d,c)}},concatSeries:function(b,d,a,c){function e(b,c){if(k)throw Error("Callback was already called.");k=!0;c&&Array.prototype.push.apply(h,Array.isArray(c)?c:[c]);if(b)return a(b,h);if(++l>=f)return a(null,h);g()}a=a||function(){};var f,g,k,h=[],l=0,m=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;if(!f)return a(null,h);g=function(){k=!1;m(b[l],e)}}else{var n=Object.keys(b);
f=n.length;if(!f)return a(null,h);g=function(){k=!1;m(b[n[l]],e)}}g()},concatLimit:function(b,d,a,c,e){function f(a,b){b&&Array.prototype.push.apply(h,Array.isArray(b)?b:[b]);a?(c(a,h),c=function(){}):++l>=g?(c(null,h),c=function(){}):l>=m+d&&(m=l,k())}c=c||function(){};var g,k,h=[],l=0,m=0,n=e?a.bind(e):a;if(Array.isArray(b)){g=b.length;if(!g)return c(null,h);k=function(){r(d,function(a){m+a>=g||n(b[m+a],q(f))})}}else{var p=Object.keys(b);g=p.length;if(!g)return c(null,h);k=function(){r(d,function(a){m+
a>=g||n(b[p[m+a]],q(f))})}}k()},multiEach:function(b,d,a){function c(c){c?(a(c),a=function(){}):k>=g&&l&&(a(null,b),a=function(){})}function e(a){var b=f[a];return function(d,f){if(d)return c(d);var q=e(a+1);b&&"object"==typeof f&&ma(f,function(a,d){if(a===h)return l=!0,c();g++;b(a,d,q)});if(a)return k++,c()}}a=a||function(){};var f=Array.isArray(d)?d:t(d);if(!d||!f.length)return a(null,b);var g=0,k=0,h={},l=!1;d=Array.isArray(b)?w(b):t(b);d.push(h);e(0)(null,d)},parallel:fa,series:ga,parallelLimit:R,
waterfall:function(b,d,a){var c=function(){return a?function(b,c,d){function k(a){if(a)return d(a);var c=u(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=u(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)}}}();O(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=u(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=u(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 ha.apply(null,la(arguments))},seq:ha,applyEach:ia(),applyEachSeries:ia("series"),queue:function(b,d,a){function c(a,b,c){var d=Array.isArray(a)?a:[a];a&&d.length?(e.started=!0,b="function"==typeof b?b:null,s(d,function(a){a={task:a,callback:b};c?e.tasks.unshift(a):e.tasks.push(a);"function"==typeof e.saturated&&e.length()>=e.concurrency&&e.saturated();x(e.process)})):e.idle()&&"function"==typeof e.drain&&x(e.drain)}var e=ja(b,
d,a);e.unshift=function(a,b){c(a,b,!0)};e.push=function(a,b){c(a,b)};return e},priorityQueue:ja,cargo:function(b,d){var a={tasks:[],payload:d,saturated:null,empty:null,drain:null,drained:!0,push:function(b,c){b=Array.isArray(b)?b:[b];c="function"==typeof c?c:null;s(b,function(b){a.tasks.push({data:b,callback:c});a.drained=!1;"function"==typeof a.saturated&&a.length()===a.payload&&a.saturated()});x(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()||"function"!=typeof a.empty||a.empty();c=!0;b(f,function(){c=!1;var b=arguments;s(e,function(a){a.callback&&a.callback.apply(null,b)});a.process()})}else"function"!=typeof 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--;s(g.slice(0),function(a){a()})}d=d?q(d):function(){};var e=Object.keys(b),f=e.length;if(!f)return d();
var g=[],k={};a(function(){f||d(null,k)});v(b,function(b,e){function f(a){var b=u(arguments,1);1>=b.length&&(b=b[0]);if(a){var g=z(k);g[e]=b;return d(a,g)}k[e]=b;x(c)}function n(){return!k.hasOwnProperty(e)&&T(r,function(a){return k.hasOwnProperty(a)})}function p(){if(n()){var a;a:{a=-1;for(var b=g.length;++a<b;)if(g[a]===p)break a;a=-1}0<=a&&g.splice(a,1);s(f,k)}}b=Array.isArray(b)?b:[b];var q=b.length,r=b.slice(0,q-1),s=b[q-1];if(n())return s(f,k);a(p)},e)},retry:function(b,d,a){function c(c,f){a=
c||a||function(){};var g,k;ka(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)})}"function"==typeof b&&(a=d,d=b,b=5);b=parseInt(b,10)||5;return"function"==typeof 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=[];Array.isArray(b)?a=b.length:(c=Object.keys(b),a=c.length);return d(0)},apply:function(b){var d=u(arguments,1);return function(){b.apply(null,
Array.prototype.concat.apply(d,E(arguments)))}},nextTick:D,setImmediate:x,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;r(b,function(a){h(a,q(e(a)))})},timesSeries:ka,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(){r(d,function(a){l+a>=b||(a=l+a,m(a,q(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(){F.async=na;return B},eventEmitter:function(b){b=b||{};var d=b.limit;return b.parallel&&!d?new y(fa):b.parallel||b.parallelLimit?new y(R,d):new y(b.emitter)},EventEmitter:y};C[typeof module]&&module&&module.exports?module.exports=B:C[typeof define]&&define&&define.amd?define([],function(){return B}):F.async=B;y.prototype.on=
function d(a,c){var e=this;"object"==typeof a?v(a,function(a,c){d.call(e,c,a)}):(e._events[a]=e._events[a]||[],Array.isArray(c)?Array.prototype.push.apply(e._events[a],c):e._events[a].push(c));return e};y.prototype.once=function a(c,e){var f=this;"object"==typeof c?v(c,function(c,e){a.call(f,e,c)}):(Array.isArray(e)?T(e,function(a){a._once=!0}):e._once=!0,f.on(c,e));return f};y.prototype.emit=function(a,c,e){function f(a,e){for(var f=g.length;--f;)g[f]._once&&g.splice(f,1);c(a,e)}c=c||function(){};
var g=this._events[a]||[];if(!g.length)return c();a=this._emitter;a=e?a.bind(e):a;a===R?a(g,this._limit,f):a(g,f);return this}}).call(this);
{
"name": "neo-async",
"version": "0.3.4",
"version": "0.4.0",
"description": "Neo-Async is compatible with Async.js, it is faster and has more feature.",

@@ -28,3 +28,3 @@ "main": "index.js",

"async": "^0.9.0",
"coveralls": "^2.11.2",
"codecov.io": "0.0.8",
"func-comparator": "^0.2.0",

@@ -31,0 +31,0 @@ "intelli-espower-loader": "^0.5.0",

# Neo-Async
[![Build Status](https://travis-ci.org/suguru03/neo-async.svg?branch=master)](https://travis-ci.org/suguru03/Neo-Async)
[![Coverage Status](https://coveralls.io/repos/suguru03/Neo-Async/badge.png?branch=master)](https://coveralls.io/r/suguru03/Neo-Async?branch=master)
[![codecov.io](https://codecov.io/github/suguru03/neo-async/coverage.svg?branch=master)](https://codecov.io/github/suguru03/neo-async?branch=master)
![Neo-Async](https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/neo_async.png)

@@ -124,2 +123,4 @@

* async.noConflict
* async.eventEmitter
* async.EventEmitter

@@ -147,3 +148,3 @@ ---

};
async.each(collection, iterator, function(err, res) {
async.concat(collection, iterator, function(err, res) {
assert.deepEqual(res, [1, 2, 3]);

@@ -157,2 +158,58 @@ assert.deepEqual(order, [1, 2, 3]);

<a name='concatSeries'/>
### concatSeries(collection, iterator, callback, thisArg)
__Arguments__
1. collection (Array|Object): The collection to iterate over.
2. iterator(item, callback) (Function): The function called per iteration.
3. callback(err) (Function): The function called at the end.
4. thisArg (*): The this binding of iterator.
```js
var order = [];
var collection = [1, 3, 2];
var iterator = function(num, done) {
setTimeout(function() {
order.push(num);
done(null, num);
}, num * 10);
};
async.concatSeries(collection, iterator, function(err, res) {
assert.deepEqual(res, [1, 3, 2]);
assert.deepEqual(order, [1, 3, 2]);
});
```
---
<a name='concatLimit'/>
### concatLimit(collection, limit, iterator, callback, thisArg)
__Arguments__
1. collection (Array|Object): The collection to iterate over.
2. limit (Number): The maximum number of iterators to run at any time.
3. iterator(item, callback) (Function): The function called per iteration.
4. callback(err) (Function): The function called at the end.
5. thisArg (*): The this binding of iterator.
```js
var order = [];
var collection = [1, 3, 2];
var iterator = function(num, done) {
setTimeout(function() {
order.push(num);
done(null, num);
}, num * 10);
};
async.concatSeries(collection, iterator, function(err, res) {
assert.deepEqual(res, [1, 3, 2]);
assert.deepEqual(order, [1, 3, 2]);
});
```
---
<a name='each'/>

@@ -253,3 +310,3 @@ ### each(collection, iterator, callback, thisArg)

<a name='multiEach'/>
### multiEach (collection, tasks, callback)
### multiEach(collection, tasks, callback)
This function provides asynchronous and straight-forward to deep nested each functions, in parallel.

@@ -256,0 +313,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