Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = applyEach;
|
---|
| 7 |
|
---|
| 8 | var _slice = require('./slice');
|
---|
| 9 |
|
---|
| 10 | var _slice2 = _interopRequireDefault(_slice);
|
---|
| 11 |
|
---|
| 12 | var _initialParams = require('./initialParams');
|
---|
| 13 |
|
---|
| 14 | var _initialParams2 = _interopRequireDefault(_initialParams);
|
---|
| 15 |
|
---|
| 16 | var _wrapAsync = require('./wrapAsync');
|
---|
| 17 |
|
---|
| 18 | var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
---|
| 19 |
|
---|
| 20 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 21 |
|
---|
| 22 | function applyEach(eachfn) {
|
---|
| 23 | return function (fns /*, ...args*/) {
|
---|
| 24 | var args = (0, _slice2.default)(arguments, 1);
|
---|
| 25 | var go = (0, _initialParams2.default)(function (args, callback) {
|
---|
| 26 | var that = this;
|
---|
| 27 | return eachfn(fns, function (fn, cb) {
|
---|
| 28 | (0, _wrapAsync2.default)(fn).apply(that, args.concat(cb));
|
---|
| 29 | }, callback);
|
---|
| 30 | });
|
---|
| 31 | if (args.length) {
|
---|
| 32 | return go.apply(this, args);
|
---|
| 33 | } else {
|
---|
| 34 | return go;
|
---|
| 35 | }
|
---|
| 36 | };
|
---|
| 37 | }
|
---|
| 38 | module.exports = exports['default']; |
---|
Note:
See
TracBrowser
for help on using the repository browser.