map-values

v4.17.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
135
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
6 years ago
SIZE
7 KB
Creates an object with the same keys as `object` and values generated by running each own enumerable string keyed property of `object` thru `iteratee`.
1 contributor
Install map-values as a package?
Copied
npm i @bit/lodash.lodash.map-values
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
mapValues (
object:Object,
iteratee:Function?
) : Object

Creates an object with the same keys as object and values generated by running each own enumerable string keyed property of object thru iteratee. The iteratee is invoked with three arguments: (value, key, object).

Example
var users = {
  'fred':    { 'user': 'fred',    'age': 40 },
  'pebbles': { 'user': 'pebbles', 'age': 1 }
};

_.mapValues(users, function(o) { return o.age; });
// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)

// The `_.property` iteratee shorthand.
_.mapValues(users, 'age');
// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
Arguments
object: Object

The object to iterate over.

iteratee: Function?

The function invoked per iteration.

Returns
Object

Returns the new mapped object.

Help and resources