# Module: mapValues

Creates an object with the same keys as the source object and values generated by running each own enumerable property of source thru the fn function.

import { mapValues } from 'utilist';

mapValues({ one: 'one' }, (item) => item.toUpperCase()); // returns { one: 'ONE' }

# Functions

# mapValues

mapValuesT, K›(source: T, fn: function): object

Defined in src/map-values.ts:20

Type parameters:

T

K: keyof T

Parameters:

source: T

Object to map the values from.

fn: function

Function to apply to each value.

▸ (value: T[K], key: K): T[K]

Parameters:

Name Type
value T[K]
key K

Returns: object

  • [ k: string]: T