source: trip-planner-front/node_modules/async/internal/map.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: 903 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = _asyncMap;
7
8var _noop = require('lodash/noop');
9
10var _noop2 = _interopRequireDefault(_noop);
11
12var _wrapAsync = require('./wrapAsync');
13
14var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15
16function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18function _asyncMap(eachfn, arr, iteratee, callback) {
19 callback = callback || _noop2.default;
20 arr = arr || [];
21 var results = [];
22 var counter = 0;
23 var _iteratee = (0, _wrapAsync2.default)(iteratee);
24
25 eachfn(arr, function (value, _, callback) {
26 var index = counter++;
27 _iteratee(value, function (err, v) {
28 results[index] = v;
29 callback(err);
30 });
31 }, function (err) {
32 callback(err, results);
33 });
34}
35module.exports = exports['default'];
Note: See TracBrowser for help on using the repository browser.