just-map-keys

map an object, predicate updates keys, receives (value, key, object)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
just-map-keys
4,715262.2.14 months ago5 years agoMinified + gzip package size for just-map-keys in KB

Readme

just-map-keys

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.
🍦 Try it
npm install just-map-keys
yarn add just-map-keys

Map an object, predicate updates keys, receives (value, key, object)
import map from 'just-map-keys';

// predicate updates keys, receives (value, key, object)
map({a: 'cow', b: 'sheep', c: 'pig'}, (value) => value);
  // {cow: 'cow', sheep: 'sheep', pig: 'pig'}
map([4, 5, 6], (value, key) => key + 1); // {1: 4, 2: 5, 3: 6}
map({a: 3, b: 5, c: 9}, (value, key) => key + value); // {a3: 3, b5: 5, c9: 9}
map({a: 3, b: 5, c: 9}, (value, key, obj) => obj.b + value + key);
  // {'8a': 3, '10b': 5, '14c': 9}