1 |
3a515b92
|
cagy
|
'use strict';
|
2 |
|
|
|
3 |
|
|
Object.defineProperty(exports, "__esModule", {
|
4 |
|
|
value: true
|
5 |
|
|
});
|
6 |
|
|
|
7 |
|
|
var _doParallel = require('./internal/doParallel');
|
8 |
|
|
|
9 |
|
|
var _doParallel2 = _interopRequireDefault(_doParallel);
|
10 |
|
|
|
11 |
|
|
var _map = require('./internal/map');
|
12 |
|
|
|
13 |
|
|
var _map2 = _interopRequireDefault(_map);
|
14 |
|
|
|
15 |
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16 |
|
|
|
17 |
|
|
/**
|
18 |
|
|
* Produces a new collection of values by mapping each value in `coll` through
|
19 |
|
|
* the `iteratee` function. The `iteratee` is called with an item from `coll`
|
20 |
|
|
* and a callback for when it has finished processing. Each of these callback
|
21 |
|
|
* takes 2 arguments: an `error`, and the transformed item from `coll`. If
|
22 |
|
|
* `iteratee` passes an error to its callback, the main `callback` (for the
|
23 |
|
|
* `map` function) is immediately called with the error.
|
24 |
|
|
*
|
25 |
|
|
* Note, that since this function applies the `iteratee` to each item in
|
26 |
|
|
* parallel, there is no guarantee that the `iteratee` functions will complete
|
27 |
|
|
* in order. However, the results array will be in the same order as the
|
28 |
|
|
* original `coll`.
|
29 |
|
|
*
|
30 |
|
|
* If `map` is passed an Object, the results will be an Array. The results
|
31 |
|
|
* will roughly be in the order of the original Objects' keys (but this can
|
32 |
|
|
* vary across JavaScript engines).
|
33 |
|
|
*
|
34 |
|
|
* @name map
|
35 |
|
|
* @static
|
36 |
|
|
* @memberOf module:Collections
|
37 |
|
|
* @method
|
38 |
|
|
* @category Collection
|
39 |
|
|
* @param {Array|Iterable|Object} coll - A collection to iterate over.
|
40 |
|
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
41 |
|
|
* `coll`.
|
42 |
|
|
* The iteratee should complete with the transformed item.
|
43 |
|
|
* Invoked with (item, callback).
|
44 |
|
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
45 |
|
|
* functions have finished, or an error occurs. Results is an Array of the
|
46 |
|
|
* transformed items from the `coll`. Invoked with (err, results).
|
47 |
|
|
* @example
|
48 |
|
|
*
|
49 |
|
|
* async.map(['file1','file2','file3'], fs.stat, function(err, results) {
|
50 |
|
|
* // results is now an array of stats for each file
|
51 |
|
|
* });
|
52 |
|
|
*/
|
53 |
|
|
exports.default = (0, _doParallel2.default)(_map2.default);
|
54 |
|
|
module.exports = exports['default'];
|