Comparing version 0.3.0 to 0.3.1
471
lib/async.js
@@ -27,2 +27,5 @@ (function() { | ||
filterLimit: createFilter('limit'), | ||
select: createFilter(), | ||
selectSeries: createFilter('series'), | ||
selectLimit: createFilter('limit'), | ||
reject: reject, | ||
@@ -111,25 +114,5 @@ rejectSeries: rejectSeries, | ||
// base on lodash | ||
function _keys(object) { | ||
return Object.keys(object); | ||
} | ||
function _isArray(array) { | ||
return Array.isArray(array); | ||
} | ||
function _isNumber(number) { | ||
return typeof number == 'number'; | ||
} | ||
function _isFunction(func) { | ||
return typeof func == 'function'; | ||
} | ||
function _toArray(collection) { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
var index = -1; | ||
@@ -208,3 +191,3 @@ var length = keys.length; | ||
keys = keys || _keys(object); | ||
keys = keys || Object.keys(object); | ||
@@ -226,3 +209,3 @@ var index = -1; | ||
return _isArray(collection) ? _arrayEach(collection, iterator) : _objectEach(collection, iterator); | ||
return Array.isArray(collection) ? _arrayEach(collection, iterator) : _objectEach(collection, iterator); | ||
} | ||
@@ -267,3 +250,3 @@ | ||
var keys = _keys(item); | ||
var keys = Object.keys(item); | ||
var length = keys.length; | ||
@@ -313,3 +296,3 @@ var index = -1; | ||
if (_isFunction(setImmediate)) { | ||
if (typeof setImmediate == 'function') { | ||
_nextTick = function(func) { | ||
@@ -328,3 +311,3 @@ setImmediate(func); | ||
_nextTick = process.nextTick; | ||
if (_isFunction(setImmediate)) { | ||
if (typeof setImmediate == 'function') { | ||
_setImmediate = function(func) { | ||
@@ -362,4 +345,3 @@ setImmediate(func); | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size; | ||
var completed = 0; | ||
@@ -371,3 +353,3 @@ var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -379,3 +361,3 @@ if (!size) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -410,8 +392,7 @@ if (!size) { | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size, iterate, called; | ||
var completed = 0; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -422,6 +403,7 @@ if (!size) { | ||
iterate = function() { | ||
_iterator(collection[completed], once(done)); | ||
called = false; | ||
_iterator(collection[completed], done); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -432,2 +414,3 @@ if (!size) { | ||
iterate = function() { | ||
called = false; | ||
_iterator(collection[keys[completed]], once(done)); | ||
@@ -441,9 +424,13 @@ }; | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (err) { | ||
return callback(err); | ||
} | ||
if (bool === false) { | ||
if (++completed >= size) { | ||
return callback(); | ||
} | ||
if (++completed >= size) { | ||
if (bool === false) { | ||
return callback(); | ||
@@ -459,10 +446,8 @@ } | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size, iterate; | ||
var completed = 0; | ||
var beforeCompleted = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -481,3 +466,3 @@ if (!size) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -501,18 +486,17 @@ if (!size) { | ||
if (called) { | ||
if (err) { | ||
callback(err); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
if (++completed >= size) { | ||
callback(); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (bool === false) { | ||
called = true; | ||
return callback(); | ||
callback(); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(); | ||
} | ||
if (completed >= beforeCompleted + limit) { | ||
@@ -529,14 +513,13 @@ beforeCompleted = completed; | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var result = []; | ||
var size, result; | ||
var count = 0; | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate = function(item) { | ||
_iterator(item, once(createCallback(count++))); | ||
_iterator(item, createCallback(count++)); | ||
}; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
result = Array(size); | ||
if (!size) { | ||
@@ -547,4 +530,5 @@ return callback(null, result); | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
result = Array(size); | ||
if (!size) { | ||
@@ -558,15 +542,21 @@ return callback(null, result); | ||
var called = false; | ||
return function(err, res) { | ||
if (called) { | ||
return; | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
result[index] = res; | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
callback(err, _arrayClone(result)); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
callback(null, result); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -580,11 +570,9 @@ }; | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var result = []; | ||
var size, result, iterate; | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
result = Array(size); | ||
if (!size) { | ||
@@ -594,7 +582,8 @@ return callback(null, result); | ||
iterate = function() { | ||
_iterator(collection[completed], once(createCallback(completed))); | ||
_iterator(collection[completed], createCallback(completed)); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
result = Array(size); | ||
if (!size) { | ||
@@ -604,3 +593,3 @@ return callback(null, result); | ||
iterate = function() { | ||
_iterator(collection[keys[completed]], once(createCallback(completed))); | ||
_iterator(collection[keys[completed]], createCallback(completed)); | ||
}; | ||
@@ -613,13 +602,22 @@ } | ||
var called = false; | ||
return function(err, res) { | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
result[index] = res; | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
callback(err, _arrayClone(result)); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
callback(null, result); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -636,12 +634,10 @@ | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var result = []; | ||
var size, result, iterate; | ||
var completed = 0; | ||
var beforeCompleted = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
result = Array(size); | ||
if (!size) { | ||
@@ -656,8 +652,9 @@ return callback(null, result); | ||
var index = beforeCompleted + n; | ||
_iterator(collection[index], once(createCallback(index))); | ||
_iterator(collection[index], createCallback(index)); | ||
}); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
result = Array(size); | ||
if (!size) { | ||
@@ -672,3 +669,3 @@ return callback(null, result); | ||
var index = beforeCompleted + n; | ||
_iterator(collection[keys[index]], once(createCallback(index))); | ||
_iterator(collection[keys[index]], createCallback(index)); | ||
}); | ||
@@ -682,16 +679,22 @@ }; | ||
var called = false; | ||
return function(err, res) { | ||
if (called) { | ||
return; | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
result[index] = res; | ||
if (err) { | ||
called = true; | ||
return callback(err); | ||
callback(err, _arrayClone(result)); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
callback(null, result); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -739,3 +742,3 @@ if (completed >= beforeCompleted + limit) { | ||
callback(_isArray(collection) ? result : _toArray(result)); | ||
callback(Array.isArray(collection) ? result : _toArray(result)); | ||
}; | ||
@@ -764,12 +767,11 @@ } | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size; | ||
var completed = 0; | ||
var called = false; | ||
var createCallback = getCreateCallback(); | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate = function(item) { | ||
_iterator(item, once(createCallback(item))); | ||
_iterator(item, createCallback(item)); | ||
}; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -781,3 +783,3 @@ if (!size) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -798,13 +800,11 @@ if (!size) { | ||
if (called) { | ||
if (!bool) { | ||
callback(item); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (!bool) { | ||
called = true; | ||
return callback(item); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
callback(); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -818,13 +818,11 @@ }; | ||
if (called) { | ||
if (bool) { | ||
callback(item); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (bool) { | ||
called = true; | ||
return callback(item); | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
callback(); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -841,9 +839,8 @@ }; | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size, iterate; | ||
var completed = 0; | ||
var createCallback = getCreateCallback(); | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -855,6 +852,6 @@ if (!size) { | ||
var item = collection[completed]; | ||
_iterator(item, once(createCallback(item))); | ||
_iterator(item, createCallback(item)); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -905,3 +902,2 @@ if (!size) { | ||
} | ||
@@ -912,11 +908,9 @@ | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size, iterate; | ||
var completed = 0; | ||
var beforeCompleted = 0; | ||
var called = false; | ||
var createCallback = getCreateCallback(); | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -937,3 +931,3 @@ if (!size) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -965,12 +959,11 @@ if (!size) { | ||
if (called) { | ||
if (!bool) { | ||
callback(item); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (!bool) { | ||
called = true; | ||
return callback(item); | ||
} | ||
if (++completed >= size) { | ||
return callback(); | ||
callback(); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -988,12 +981,11 @@ if (completed >= beforeCompleted + limit) { | ||
if (called) { | ||
if (bool) { | ||
callback(item); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (bool) { | ||
called = true; | ||
return callback(item); | ||
} | ||
if (++completed >= size) { | ||
return callback(); | ||
callback(); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -1013,4 +1005,4 @@ if (completed >= beforeCompleted + limit) { | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var size; | ||
var isArray = Array.isArray(collection); | ||
var result = {}; | ||
@@ -1021,3 +1013,3 @@ var completed = 0; | ||
var iterate = function(item, key) { | ||
_iterator(item, once(createCallback(key, item))); | ||
_iterator(item, createCallback(key, item)); | ||
}; | ||
@@ -1032,3 +1024,3 @@ | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1047,4 +1039,10 @@ if (!size) { | ||
var called = false; | ||
return function(bool) { | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (!bool) { | ||
@@ -1061,4 +1059,10 @@ result[key + ''] = item; | ||
var called = false; | ||
return function(bool) { | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (bool) { | ||
@@ -1079,4 +1083,4 @@ result[key + ''] = item; | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var size, iterate; | ||
var isArray = Array.isArray(collection); | ||
var result = {}; | ||
@@ -1086,3 +1090,2 @@ var completed = 0; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
@@ -1096,6 +1099,6 @@ if (isArray) { | ||
var item = collection[completed]; | ||
_iterator(item, once(createCallback(completed, item))); | ||
_iterator(item, createCallback(completed, item)); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1108,3 +1111,3 @@ if (!size) { | ||
var item = collection[key]; | ||
_iterator(item, once(createCallback(key, item))); | ||
_iterator(item, createCallback(key, item)); | ||
}; | ||
@@ -1121,4 +1124,10 @@ } | ||
var called = false; | ||
return function(bool) { | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (!bool) { | ||
@@ -1136,4 +1145,10 @@ result[key + ''] = item; | ||
var called = false; | ||
return function(bool) { | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (bool) { | ||
@@ -1154,4 +1169,4 @@ result[key + ''] = item; | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var size, iterate; | ||
var isArray = Array.isArray(collection); | ||
var result = {}; | ||
@@ -1162,3 +1177,2 @@ var completed = 0; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
@@ -1181,3 +1195,3 @@ if (isArray) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1247,8 +1261,7 @@ if (!size) { | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size, iterate, called; | ||
var completed = 0; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -1259,7 +1272,8 @@ if (!size) { | ||
iterate = function(result) { | ||
called = false; | ||
var item = collection[completed]; | ||
_iterator(result, item, once(done)); | ||
_iterator(result, item, done); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1270,5 +1284,6 @@ if (!size) { | ||
iterate = function(result) { | ||
called = false; | ||
var key = keys[completed]; | ||
var item = collection[key]; | ||
_iterator(result, item, once(done)); | ||
_iterator(result, item, done); | ||
}; | ||
@@ -1281,2 +1296,6 @@ } | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (err) { | ||
@@ -1296,8 +1315,7 @@ return callback(err); | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size, iterate, called; | ||
var completed = 0; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -1308,7 +1326,8 @@ if (!size) { | ||
iterate = function(result) { | ||
called = false; | ||
var item = collection[size - completed - 1]; | ||
_iterator(result, item, once(done)); | ||
_iterator(result, item, done); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1319,5 +1338,6 @@ if (!size) { | ||
iterate = function(result) { | ||
called = false; | ||
var key = keys[size - completed - 1]; | ||
var item = collection[key]; | ||
_iterator(result, item, once(done)); | ||
_iterator(result, item, done); | ||
}; | ||
@@ -1330,2 +1350,6 @@ } | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (err) { | ||
@@ -1346,3 +1370,3 @@ return callback(err); | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var isArray = Array.isArray(collection); | ||
var result = isArray ? [] : {}; | ||
@@ -1363,3 +1387,3 @@ var completed = 0; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1397,3 +1421,3 @@ if (!size) { | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var isArray = Array.isArray(collection); | ||
var result = isArray ? [] : {}; | ||
@@ -1413,3 +1437,3 @@ var completed = 0; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1447,3 +1471,3 @@ if (!size) { | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var isArray = Array.isArray(collection); | ||
var result = isArray ? [] : {}; | ||
@@ -1472,3 +1496,3 @@ var completed = 0; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1638,6 +1662,5 @@ if (!size) { | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var size; | ||
var result = []; | ||
var completed = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
@@ -1648,3 +1671,3 @@ var iterate = function(item) { | ||
if (_isArray(collection)) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -1656,3 +1679,3 @@ if (!size) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1667,15 +1690,14 @@ if (!size) { | ||
if (called) { | ||
return; | ||
} | ||
if (array) { | ||
Array.prototype.push.apply(result, _isArray(array) ? array : [array]); | ||
Array.prototype.push.apply(result, Array.isArray(array) ? array : [array]); | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err, result); | ||
callback(err, _arrayClone(result)); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
callback(null, result); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -1689,10 +1711,8 @@ } | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var size, iterate, called; | ||
var result = []; | ||
var completed = 0; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (isArray) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -1703,6 +1723,7 @@ if (!size) { | ||
iterate = function() { | ||
_iterator(collection[completed], once(done)); | ||
called = false; | ||
_iterator(collection[completed], done); | ||
}; | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1713,3 +1734,4 @@ if (!size) { | ||
iterate = function() { | ||
_iterator(collection[keys[completed]], once(done)); | ||
called = false; | ||
_iterator(collection[keys[completed]], done); | ||
}; | ||
@@ -1721,4 +1743,8 @@ } | ||
if (called) { | ||
throw new Error('Callback was already called.'); | ||
} | ||
called = true; | ||
if (array) { | ||
Array.prototype.push.apply(result, _isArray(array) ? array : [array]); | ||
Array.prototype.push.apply(result, Array.isArray(array) ? array : [array]); | ||
} | ||
@@ -1739,12 +1765,9 @@ if (err) { | ||
callback = callback || function() {}; | ||
var size = 0; | ||
var isArray = _isArray(collection); | ||
var size, iterate; | ||
var result = []; | ||
var completed = 0; | ||
var beforeCompleted = 0; | ||
var called = false; | ||
var _iterator = thisArg ? iterator.bind(thisArg) : iterator; | ||
var iterate; | ||
if (isArray) { | ||
if (Array.isArray(collection)) { | ||
size = collection.length; | ||
@@ -1764,3 +1787,3 @@ if (!size) { | ||
} else { | ||
var keys = _keys(collection); | ||
var keys = Object.keys(collection); | ||
size = keys.length; | ||
@@ -1785,16 +1808,14 @@ if (!size) { | ||
if (called) { | ||
return; | ||
} | ||
if (array) { | ||
Array.prototype.push.apply(result, _isArray(array) ? array : [array]); | ||
Array.prototype.push.apply(result, Array.isArray(array) ? array : [array]); | ||
} | ||
if (err) { | ||
called = true; | ||
return callback(err, result); | ||
callback(err, result); | ||
callback = function() {}; | ||
return; | ||
} | ||
if (++completed >= size) { | ||
called = true; | ||
return callback(null, result); | ||
callback(null, result); | ||
callback = function() {}; | ||
return; | ||
} | ||
@@ -1812,3 +1833,3 @@ if (completed >= beforeCompleted + limit) { | ||
callback = callback || function() {}; | ||
var arrayTasks = _isArray(tasks) ? tasks : _toArray(tasks); | ||
var arrayTasks = Array.isArray(tasks) ? tasks : _toArray(tasks); | ||
if (!tasks || !arrayTasks.length) { | ||
@@ -1822,3 +1843,3 @@ return callback(null, collection); | ||
var endFlag = false; | ||
var col = _isArray(collection) ? _arrayClone(collection) : _toArray(collection); | ||
var col = Array.isArray(collection) ? _arrayClone(collection) : _toArray(collection); | ||
col.push(end); | ||
@@ -1862,3 +1883,3 @@ createCallback(0)(null, col); | ||
} | ||
}; | ||
}; | ||
} | ||
@@ -2119,3 +2140,3 @@ | ||
function done(err, res) { | ||
res = _isArray(res) ? res : [res]; | ||
res = Array.isArray(res) ? res : [res]; | ||
res.unshift(err); | ||
@@ -2167,6 +2188,6 @@ callback.apply(self, res); | ||
var _tasks = _isArray(tasks) ? tasks : [tasks]; | ||
var _tasks = Array.isArray(tasks) ? tasks : [tasks]; | ||
if (!tasks || !_tasks.length) { | ||
if (q.idle() && _isFunction(q.drain)) { | ||
if (q.idle() && typeof q.drain == 'function') { | ||
_setImmediate(q.drain); | ||
@@ -2178,3 +2199,3 @@ } | ||
q.started = true; | ||
callback = _isFunction(callback) ? callback : null; | ||
callback = typeof callback == 'function' ? callback : null; | ||
_arrayEach(_tasks, function(task) { | ||
@@ -2191,3 +2212,3 @@ | ||
} | ||
if (_isFunction(q.saturated) && q.length() >= q.concurrency) { | ||
if (typeof q.saturated == 'function' && q.length() >= q.concurrency) { | ||
q.saturated(); | ||
@@ -2231,6 +2252,6 @@ } | ||
var _tasks = _isArray(tasks) ? tasks : [tasks]; | ||
var _tasks = Array.isArray(tasks) ? tasks : [tasks]; | ||
if (!tasks || !_tasks.length) { | ||
if (q.idle() && _isFunction(q.drain)) { | ||
if (q.idle() && typeof q.drain == 'function') { | ||
_setImmediate(q.drain); | ||
@@ -2242,3 +2263,3 @@ } | ||
q.started = true; | ||
callback = _isFunction(callback) ? callback : null; | ||
callback = typeof callback == 'function' ? callback : null; | ||
_arrayEach(_tasks, function(task) { | ||
@@ -2257,3 +2278,3 @@ | ||
if (_isFunction(q.saturated) && q.length() >= q.concurrency) { | ||
if (typeof q.saturated == 'function' && q.length() >= q.concurrency) { | ||
q.saturated(); | ||
@@ -2282,3 +2303,3 @@ } | ||
var task = q.tasks.shift(); | ||
if (_isFunction(q.empty) && !q.length()) { | ||
if (typeof q.empty == 'function' && !q.length()) { | ||
q.empty(); | ||
@@ -2297,3 +2318,3 @@ } | ||
} | ||
if (_isFunction(q.drain) && q.idle()) { | ||
if (typeof q.drain == 'function' && q.idle()) { | ||
q.drain(); | ||
@@ -2359,4 +2380,4 @@ } | ||
data = _isArray(data) ? data : [data]; | ||
callback = _isFunction(callback) ? callback : null; | ||
data = Array.isArray(data) ? data : [data]; | ||
callback = typeof callback == 'function' ? callback : null; | ||
@@ -2371,3 +2392,3 @@ _arrayEach(data, function(task) { | ||
if (_isFunction(c.saturated) && c.length() === c.payload) { | ||
if (typeof c.saturated == 'function' && c.length() === c.payload) { | ||
c.saturated(); | ||
@@ -2386,3 +2407,3 @@ } | ||
if (!c.length()) { | ||
if (_isFunction(c.drain) && !c.drained) { | ||
if (typeof c.drain == 'function' && !c.drained) { | ||
c.drain(); | ||
@@ -2394,6 +2415,6 @@ } | ||
var tasks = _isNumber(c.payload) ? c.tasks.splice(0, payload) : c.tasks; | ||
var tasks = typeof c.payload == 'number' ? c.tasks.splice(0, payload) : c.tasks; | ||
var data = _pluck(tasks, 'data'); | ||
if (!c.length() && _isFunction(c.empty)) { | ||
if (!c.length() && typeof c.empty == 'function') { | ||
c.empty(); | ||
@@ -2433,3 +2454,3 @@ } | ||
callback = callback ? once(callback) : function() {}; | ||
var keys = _keys(tasks); | ||
var keys = Object.keys(tasks); | ||
var remainingTasks = keys.length; | ||
@@ -2451,3 +2472,3 @@ if (!remainingTasks) { | ||
task = _isArray(task) ? task : [task]; | ||
task = Array.isArray(task) ? task : [task]; | ||
var size = task.length; | ||
@@ -2522,3 +2543,3 @@ var requires = task.slice(0, size - 1); | ||
var DEFAULT_TIMES = 5; | ||
if (_isFunction(limit)) { | ||
if (typeof limit == 'function') { | ||
callback = task; | ||
@@ -2531,3 +2552,3 @@ task = limit; | ||
return _isFunction(callback) ? wrappedTask() : wrappedTask; | ||
return typeof callback == 'function' ? wrappedTask() : wrappedTask; | ||
@@ -2573,6 +2594,6 @@ function wrappedTask(wrappedCallback, wrappedResults) { | ||
var keys = []; | ||
if (_isArray(tasks)) { | ||
if (Array.isArray(tasks)) { | ||
size = tasks.length; | ||
} else { | ||
keys = _keys(tasks); | ||
keys = Object.keys(tasks); | ||
size = keys.length; | ||
@@ -2579,0 +2600,0 @@ } |
@@ -1,36 +0,40 @@ | ||
(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); | ||
(function(){function u(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 t(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 ea(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&&!1!==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];if(!1===d(b[f],f,b))break}return b}function fa(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 ga(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 A(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 S(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 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,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 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]],p(e))}}g()}function T(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 U(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,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 V(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,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 z(b){function d(a,b,g,d){g=c(a,g);I(a,b,g,d)}function a(a,b,g,d,h){d=c(a,d);J(a,b,g,d,h)}function c(a,b){return function(c){b(Array.isArray(a)?c:u(c))}}switch(b){case "series":return d;case "limit":return a;default:return function(a,b,d,k){d=c(a,d);K(a,b,d,k)}}}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();x(b,d)}}function M(b,d,a,c,e){a=a||function(){};var f,g,k=0,h=function(){function b(c){return function(b){if(!b)return a(c);if(++k>=f)return a();g()}}function c(b){return function(c){if(c)return a(b);if(++k>=f)return a();g()}}return e?b:c}(),l=c?d.bind(c):d;if(Array.isArray(b)){f=b.length;if(!f)return a();g=function(){var a= | ||
b[k];l(a,h(a))}}else{var m=Object.keys(b);f=m.length;if(!f)return a();g=function(){var a=b[m[k]];l(a,p(h(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,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 K(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?u(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? | ||
u(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?u(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?u(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?u(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?u(l):l);m>=n+d&&(n=m,k())}}return f?a:b}(),y=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];y(c,p(q(a,c)))}})}}else{var B=Object.keys(b);g=B.length;if(!g)return c({});k=function(){r(d,function(a){if(!(n+a>=g)){a=B[n+a];var c=b[a];y(c,p(q(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 X(b,d,a,c){function e(b,c){if(!l){if(b)return l=!0,a(b,g?v(k):A(k));if(!1===c)return l=!0,a(null,g?v(k):A(k));++h>=f&&(l=!0,a(null,k))}}a=a||function(){};var f=0,g=Array.isArray(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);s(b,d)}else{c=Object.keys(b);f=c.length;if(!f)return a(null,k);x(b,d,c)}}function Y(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=Array.isArray(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,p(e))}}else{var n=Object.keys(b),f=n.length;if(!f)return a(null,k);m=function(){var a=n[h];l(k,b[a],a,p(e))}}m()}function Z(b,d,a,c,e){function f(a,b){if(!n){if(a)return n=!0,c(a,k?v(h):A(h)); | ||
if(!1===b)return n=!0,c(null,k?v(h):A(h));if(++l>=g)return n=!0,c(null,h);l>=m+d&&(m=l,y())}}c=c||function(){};var g=0,k=Array.isArray(b),h=k?[]:{},l=0,m=0,n=!1,q=e?a.bind(e):a,y;if(k){g=b.length;if(!g)return c(null,h);y=function(){r(d,function(a){m+a>=g||(a=m+a,q(h,b[a],a,p(f)))})}}else{var B=Object.keys(b),g=B.length;if(!g)return c(null,h);y=function(){r(d,function(a){m+a>=g||(a=B[m+a],q(h,b[a],a,p(f)))})}}y()}function P(b){function d(a,b,d,h){b=c(b,h);V(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,S(d,"item"))}}switch(b){case "series":return d;case "limit":return a;default:return function(a,b,d,h){b=c(b,h);U(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 $(){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=t(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 aa(b){var d="series"===b?H:G;return function(a){var b=this,e=t(arguments,1),f=e.pop()||function(){};d(a,function(a,d){a.apply(b,e.concat(d))},f)}}function ba(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(){C.setImmediate(e.process)}))},_worker:b,_thisArg:a},f=0;return e}function ca(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 R(b){function d(a){var c=t(arguments,1);console&&(a?console.error&&console.error(a):console[b]&&s(c,console[b]))}return function(a){var b=t(arguments,1);b.push(d);a.apply(null,b)}}var F=this,ha=F&&F.async,D,w;(function(){process&&process.nextTick?(D=process.nextTick,w="function"==typeof setImmediate? | ||
function(b){setImmediate(b)}:D):w=D="function"==typeof setImmediate?function(b){setImmediate(b)}:function(b){setTimeout(b,0)}})();var C={each:G,eachSeries:H,eachLimit:T,forEach:G,forEachSeries:H,forEachLimit:T,map:U,mapSeries:V,mapLimit:W,filter:z(),filterSeries:z("series"),filterLimit:z("limit"),select:z(),selectSeries:z("series"),selectLimit:z("limit"),reject:function(b,d,a,c){K(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:L, | ||
detectSeries:M,detectLimit:N,pick:K,pickSeries:I,pickLimit:J,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:X,transformSeries:Y,transformLimit:Z, | ||
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(!b)},c,!0)},everySeries:function(b,d,a,c){M(b,d,function(b){a(!b)},c,!0)},everyLimit:function(b,d,a,c,e){N(b,d,a,function(a){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&&fa(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:u(d); | ||
if(!d||!f.length)return a(null,b);var g=0,k=0,h={},l=!1;d=Array.isArray(b)?v(b):u(b);d.push(h);e(0)(null,d)},parallel:function(b,d,a){var c=Q(a);X(b,c,d,a)},series:function(b,d,a){var c=Q(a);Y(b,c,d,a)},parallelLimit:function(b,d,a,c){var e=Q(c);Z(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=t(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=t(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=t(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=t(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 $.apply(null,ea(arguments))},seq:$,applyEach:aa(),applyEachSeries:aa("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=ba(b,d,a);e.unshift=function(a,b){c(a,b,!0)};e.push=function(a,b){c(a,b)};return e},priorityQueue:ba,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=S(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=t(arguments,1);1>=b.length&&(b=b[0]);if(a){var g=A(k);g[e]=b;return d(a,g)}k[e]=b;w(c)}function n(){return!k.hasOwnProperty(e)&&ga(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;ca(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=t(arguments,1);return function(){b.apply(null,Array.prototype.concat.apply(d,E(arguments)))}},nextTick:D,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:ca,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=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:R("log"),dir:R("dir"),createLogger:R,noConflict:function(){F.async=ha;return C}},da={"function":!0,object:!0};da[typeof module]&& | ||
module&&module.exports?module.exports=C:da[typeof define]&&define&&define.amd?define([],function(){return C}):F.async=C}).call(this); |
{ | ||
"name": "neo-async", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Neo-Async is compatible with Async.js, it is faster and has more feature.", | ||
@@ -16,2 +16,8 @@ "main": "index.js", | ||
"homepage": "https://github.com/suguru03/Neo-Async", | ||
"files": [ | ||
"LICENSE", | ||
"index.js", | ||
"lib/async.js", | ||
"lib/async.min.js" | ||
], | ||
"directories": { | ||
@@ -18,0 +24,0 @@ "test": "test/" |
@@ -43,5 +43,7 @@ # Neo-Async | ||
* .each [Series, Limit] | ||
* async.each [Series, Limit] | ||
* async.forEach [Series, Limit] | ||
* async.map [Series, Limit] | ||
* async.filter [Series, Limit] | ||
* async.select [Series, Limit] | ||
* async.reject [Series, Limit] | ||
@@ -48,0 +50,0 @@ * async.detect [Series, Limit] |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
272
87500
6
2280
1