source: trip-planner-front/node_modules/async/internal/applyEach.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = applyEach;
7
8var _slice = require('./slice');
9
10var _slice2 = _interopRequireDefault(_slice);
11
12var _initialParams = require('./initialParams');
13
14var _initialParams2 = _interopRequireDefault(_initialParams);
15
16var _wrapAsync = require('./wrapAsync');
17
18var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19
20function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
22function 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}
38module.exports = exports['default'];
Note: See TracBrowser for help on using the repository browser.