mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2024-12-26 13:05:24 +00:00
32 lines
679 B
JavaScript
32 lines
679 B
JavaScript
'use strict';
|
|
|
|
var initial = require('array-initial');
|
|
var last = require('array-last');
|
|
var asyncSettle = require('async-settle');
|
|
var nowAndLater = require('now-and-later');
|
|
|
|
var helpers = require('./helpers');
|
|
|
|
function iterator(fn, key, cb) {
|
|
return asyncSettle(fn, cb);
|
|
}
|
|
|
|
function buildSettleParallel() {
|
|
var args = helpers.verifyArguments(arguments);
|
|
|
|
var extensions = helpers.getExtensions(last(args));
|
|
|
|
if (extensions) {
|
|
args = initial(args);
|
|
}
|
|
|
|
function settleParallel(done) {
|
|
var onSettled = helpers.onSettled(done);
|
|
nowAndLater.map(args, iterator, extensions, onSettled);
|
|
}
|
|
|
|
return settleParallel;
|
|
}
|
|
|
|
module.exports = buildSettleParallel;
|