blob: f611def886302ea6a71506c1177bd895a4579bea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import arrayMap from 'lodash/_arrayMap'
import rest from './rest';
import initialParams from './initialParams';
import wrapAsync from './wrapAsync';
export default function applyEach(eachfn) {
return rest(function(fns, args) {
var go = initialParams(function(args, callback) {
var that = this;
return eachfn(arrayMap(fns, wrapAsync), function (fn, cb) {
fn.apply(that, args.concat(cb));
}, callback);
});
if (args.length) {
return go.apply(this, args);
}
else {
return go;
}
});
}
|