mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 22:12:02 +02:00
Initial commit
This commit is contained in:
35
node_modules/foreachasync/forEachAsync.js
generated
vendored
Normal file
35
node_modules/foreachasync/forEachAsync.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*jshint -W054 */
|
||||
;(function (exports) {
|
||||
'use strict';
|
||||
|
||||
function forEachAsync(arr, fn, thisArg) {
|
||||
var dones = []
|
||||
, index = -1
|
||||
;
|
||||
|
||||
function next(BREAK, result) {
|
||||
index += 1;
|
||||
|
||||
if (index === arr.length || BREAK === forEachAsync.__BREAK) {
|
||||
dones.forEach(function (done) {
|
||||
done.call(thisArg, result);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
fn.call(thisArg, next, arr[index], index, arr);
|
||||
}
|
||||
|
||||
setTimeout(next, 4);
|
||||
|
||||
return {
|
||||
then: function (_done) {
|
||||
dones.push(_done);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
forEachAsync.__BREAK = {};
|
||||
|
||||
exports.forEachAsync = forEachAsync;
|
||||
}('undefined' !== typeof exports && exports || new Function('return this')()));
|
Reference in New Issue
Block a user