Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-deps / dist / loop / map / mapObjKeys.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var keys_1 = require("../../util/keys");
/**
 * The opposite of `mapValue` this method creates an object with the
 * same values as `object` and keys generated by running each own enumerable
 * string keyed property of `object` thru `iteratee`. The iteratee is invoked
 * with three arguments: (value, key, object).
 * @since 5.0.0-beta.6
 * @memberOf loop
 * @alias mapObjKeys
 *
 * @param {Object} object The object to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @return {Object} Returns the new mapped object.
 *
 * @fork 3.8.0
 * @category Object
 *
 * @see mapValue
 *
 * @example
 *
 *   var concatKey = (value, key) => key + value)
 *   mapKey({ 'a': 1, 'b': 2 }, concatKey)
 *   //=> { 'a1': 1, 'b2': 2 }
 *
 */
function mapObjKey(object, iteratee) {
    var obj = Object(object);
    var result = {};
    var keys = keys_1.default(obj);
    for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
        var key = keys_2[_i];
        var value = obj[key];
        result[iteratee(value, key, obj)] = value;
    }
    return result;
}
exports.default = mapObjKey;
//# sourceMappingURL=mapObjKeys.js.map