Creates an object with the same keys as object and values generated by running each own enumerable string key through iteratee. Part of Lodash Object since 0.8.3 (stable — not deprecated).
Note: Key insertion order in the result follows own enumerable string keys; do not rely on a specific order across older engines.
Syntax
Call _.mapValues. Start with this line.
Lodash
_.mapValues(object, [iteratee])
Call
What it does
_.mapValues(object, [iteratee])
Primary signature.
_.mapValues(object)
Work with an object’s keys, values, or paths.
Prefer import mapValues from "lodash/mapValues" when you want a smaller bundle.
Library declarations
Lodash
_.mapValues(object, [iteratee])
Parameters
This method has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
New object (source not mutated)
Lodash Examples
Example 1 — Official: Property Shorthand
Pluck one field from each nested value with a string iteratee.
Pair. Chain both when you need to reshape both sides.
Pick. Choose the helper that matches what must change.
Compatibility
Browser & Runtime Support
_.mapValues is a Lodash Object helper since 0.8.3. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 0.8.3+
_.mapValues()
Available in [email protected] full builds and the lodash/mapValues modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 0.8.3+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.mapValuesLodash 0.8.3+
Bottom line: Safe for production once Lodash is loaded. Prefer import mapValues from "lodash/mapValues" for smaller bundles. Use it to transform object values without mutating the source.
Frequently Asked Questions
_.mapValues(object, [iteratee]) creates a new object with the same keys and values produced by iteratee. Official: _.mapValues(users, 'age') → {fred:40, pebbles:1}.
It is called as (value, key, object) for each own enumerable string-keyed property. Whatever it returns becomes the new value at that key.
No. It always returns a new object. The source is left unchanged.
Function, property name string (e.g. 'age'), path arrays, and matchers — same iteratee shortcuts as other Lodash collection helpers.
mapValues keeps keys and rewrites values. mapKeys keeps values and rewrites keys.
Use import mapValues from "lodash/mapValues" or require("lodash/mapValues") for tree-shaking. Full build: import _ from "lodash" then _.mapValues.