just-deep-map-values
v1.2.0
Published
Returns an object with values at all depths mapped according to the provided function
Downloads
26,338
Maintainers
Readme
just-deep-map-values
Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.
npm install just-deep-map-values
yarn add just-deep-map-values
Returns an object with values at all depths mapped according to the provided function
import deepMapValues from 'just-deep-map-values';
const squareFn = (number) => number * number;
deepMapValues({ a: 1, b: { c: 2, d: { e: 3 } } }, squareFn); // => { a: 1, b: { c: 4, d: { e: 9 } } }