mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
63 lines
2.2 KiB
JavaScript
63 lines
2.2 KiB
JavaScript
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
|
||
|
var _mapValuesLimit = require('./mapValuesLimit');
|
||
|
|
||
|
var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
|
||
|
|
||
|
var _doLimit = require('./internal/doLimit');
|
||
|
|
||
|
var _doLimit2 = _interopRequireDefault(_doLimit);
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
/**
|
||
|
* A relative of [`map`]{@link module:Collections.map}, designed for use with objects.
|
||
|
*
|
||
|
* Produces a new Object by mapping each value of `obj` through the `iteratee`
|
||
|
* function. The `iteratee` is called each `value` and `key` from `obj` and a
|
||
|
* callback for when it has finished processing. Each of these callbacks takes
|
||
|
* two arguments: an `error`, and the transformed item from `obj`. If `iteratee`
|
||
|
* passes an error to its callback, the main `callback` (for the `mapValues`
|
||
|
* function) is immediately called with the error.
|
||
|
*
|
||
|
* Note, the order of the keys in the result is not guaranteed. The keys will
|
||
|
* be roughly in the order they complete, (but this is very engine-specific)
|
||
|
*
|
||
|
* @name mapValues
|
||
|
* @static
|
||
|
* @memberOf module:Collections
|
||
|
* @method
|
||
|
* @category Collection
|
||
|
* @param {Object} obj - A collection to iterate over.
|
||
|
* @param {AsyncFunction} iteratee - A function to apply to each value and key
|
||
|
* in `coll`.
|
||
|
* The iteratee should complete with the transformed value as its result.
|
||
|
* Invoked with (value, key, callback).
|
||
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
||
|
* functions have finished, or an error occurs. `result` is a new object consisting
|
||
|
* of each key from `obj`, with each transformed value on the right-hand side.
|
||
|
* Invoked with (err, result).
|
||
|
* @example
|
||
|
*
|
||
|
* async.mapValues({
|
||
|
* f1: 'file1',
|
||
|
* f2: 'file2',
|
||
|
* f3: 'file3'
|
||
|
* }, function (file, key, callback) {
|
||
|
* fs.stat(file, callback);
|
||
|
* }, function(err, result) {
|
||
|
* // result is now a map of stats for each file, e.g.
|
||
|
* // {
|
||
|
* // f1: [stats for file1],
|
||
|
* // f2: [stats for file2],
|
||
|
* // f3: [stats for file3]
|
||
|
* // }
|
||
|
* });
|
||
|
*/
|
||
|
|
||
|
exports.default = (0, _doLimit2.default)(_mapValuesLimit2.default, Infinity);
|
||
|
module.exports = exports['default'];
|