Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 583 Bytes

mapKeys.md

File metadata and controls

33 lines (21 loc) · 583 Bytes

objects.mapKeys

mapKeys(object, func)

MapKeys iterates over an object of values and applies a function to each key

Arguments

  1. object (Object): input object
  2. func (Function): map function

Returns

(Object): object with mutated keys

Example

const result = objects.mapKeys({ a: 1, b: 2, c: 3 }, value => `neat_${value}`);
console.log(result);
> { neat_1: 1, neat_2: 2, neat_3: 3 }