blob: 62eadfd15e054a7848d9a73b238f81ebf96de383 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import restParam from 'lodash/function/restParam';
export default function _applyEach(eachfn) {
return restParam(function(fns, args) {
var go = restParam(function(args) {
var that = this;
var callback = args.pop();
return eachfn(fns, function (fn, _, cb) {
fn.apply(that, args.concat([cb]));
},
callback);
});
if (args.length) {
return go.apply(this, args);
}
else {
return go;
}
});
}
|