CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
mapKeys.js37 linesDownload Raw Back to lodash-es
1import baseAssignValue from './_baseAssignValue.js';2import baseForOwn from './_baseForOwn.js';3import baseIteratee from './_baseIteratee.js';4 5/**6 * The opposite of `_.mapValues`; this method creates an object with the7 * same values as `object` and keys generated by running each own enumerable8 * string keyed property of `object` thru `iteratee`. The iteratee is invoked9 * with three arguments: (value, key, object).10 *11 * @static12 * @memberOf _13 * @since 3.8.014 * @category Object15 * @param {Object} object The object to iterate over.16 * @param {Function} [iteratee=_.identity] The function invoked per iteration.17 * @returns {Object} Returns the new mapped object.18 * @see _.mapValues19 * @example20 *21 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {22 *   return key + value;23 * });24 * // => { 'a1': 1, 'b2': 2 }25 */26function mapKeys(object, iteratee) {27  var result = {};28  iteratee = baseIteratee(iteratee, 3);29 30  baseForOwn(object, function(value, key, object) {31    baseAssignValue(result, iteratee(value, key, object), value);32  });33  return result;34}35 36export default mapKeys;37 
basant307/AI_Governance_Project · CoolFace