root / HServer / 00.Server / 00.Program / node_modules / async / mapValues.js
이력 | 보기 | 이력해설 | 다운로드 (2.27 KB)
1 |
'use strict';
|
---|---|
2 |
|
3 |
Object.defineProperty(exports, "__esModule", {
|
4 |
value: true |
5 |
}); |
6 |
|
7 |
var _mapValuesLimit = require('./mapValuesLimit'); |
8 |
|
9 |
var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
|
10 |
|
11 |
var _doLimit = require('./internal/doLimit'); |
12 |
|
13 |
var _doLimit2 = _interopRequireDefault(_doLimit);
|
14 |
|
15 |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
16 |
|
17 |
/**
|
18 |
* A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
|
19 |
*
|
20 |
* Produces a new Object by mapping each value of `obj` through the `iteratee`
|
21 |
* function. The `iteratee` is called each `value` and `key` from `obj` and a
|
22 |
* callback for when it has finished processing. Each of these callbacks takes
|
23 |
* two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
|
24 |
* passes an error to its callback, the main `callback` (for the `mapValues`
|
25 |
* function) is immediately called with the error.
|
26 |
*
|
27 |
* Note, the order of the keys in the result is not guaranteed. The keys will
|
28 |
* be roughly in the order they complete, (but this is very engine-specific)
|
29 |
*
|
30 |
* @name mapValues
|
31 |
* @static
|
32 |
* @memberOf module:Collections
|
33 |
* @method
|
34 |
* @category Collection
|
35 |
* @param {Object} obj - A collection to iterate over.
|
36 |
* @param {Function} iteratee - A function to apply to each value and key in
|
37 |
* `coll`. The iteratee is passed a `callback(err, transformed)` which must be
|
38 |
* called once it has completed with an error (which can be `null`) and a
|
39 |
* transformed value. Invoked with (value, key, callback).
|
40 |
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
41 |
* functions have finished, or an error occurs. `result` is a new object consisting
|
42 |
* of each key from `obj`, with each transformed value on the right-hand side.
|
43 |
* Invoked with (err, result).
|
44 |
* @example
|
45 |
*
|
46 |
* async.mapValues({
|
47 |
* f1: 'file1',
|
48 |
* f2: 'file2',
|
49 |
* f3: 'file3'
|
50 |
* }, function (file, key, callback) {
|
51 |
* fs.stat(file, callback);
|
52 |
* }, function(err, result) {
|
53 |
* // result is now a map of stats for each file, e.g.
|
54 |
* // {
|
55 |
* // f1: [stats for file1],
|
56 |
* // f2: [stats for file2],
|
57 |
* // f3: [stats for file3]
|
58 |
* // }
|
59 |
* });
|
60 |
*/
|
61 |
|
62 |
exports.default = (0, _doLimit2.default)(_mapValuesLimit2.default, Infinity); |
63 |
module.exports = exports['default'];
|