Repository URL to install this package:
|
Version:
6.0.4 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var keys_1 = require("../../util/keys");
/**
* Creates an array of values by running each property of `object` thru
* `iteratee`. The iteratee is invoked with three arguments: (value, key, object).
*
* @name mapObjVals
* @since 5.0.0-beta.6
* @memberOf loop
*
* @param object The object to iterate over.
* @param iteratee The function invoked per iteration.
* @return Returns the new mapped array.
*
* @func
* @category Object
*
* {@link https://github.com/lodash/lodash/blob/master/map.js lodash-map}
* @see {@link lodash-map}
*
* @example
*
* const square = n => n * n
* map({ 'a': 4, 'b': 8 }, square)
* //=> [16, 64] (iteration order is not guaranteed)
*
*/
function mapObjectValues(object, iteratee) {
var props = keys_1.default(object);
var result = new Array(props.length);
for (var index = 0; index < props.length; index++) {
var key = props[index];
var value = object[key];
result[index] = iteratee(value, key, object);
}
return result;
}
exports.default = mapObjectValues;
//# sourceMappingURL=mapObjVals.js.map