Projekt

Obecné

Profil

Stáhnout (903 Bajtů) Statistiky
| Větev: | Revize:
1
'use strict';
2

    
3
Object.defineProperty(exports, "__esModule", {
4
    value: true
5
});
6
exports.default = _asyncMap;
7

    
8
var _noop = require('lodash/noop');
9

    
10
var _noop2 = _interopRequireDefault(_noop);
11

    
12
var _wrapAsync = require('./wrapAsync');
13

    
14
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15

    
16
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17

    
18
function _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
}
35
module.exports = exports['default'];
(15-15/25)