Like map, but for objects — transform the value of each property in turn (official Underscore docs). Returns a new object with the same keys. Stable helper — not deprecated.
Pass the required arguments shown below. Underscore object helpers usually return a new value — check whether the source object is mutated.
Syntax
Call _.mapObject. Start with this line.
Underscore
_.mapObject(object, iteratee, [context])
Call
What it does
_.mapObject(object, iteratee, [context])
Primary signature.
_.mapObject(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Library declarations
Underscore
_.mapObject(object, iteratee, [context])
Parameters
Parameter
Description
object
Required. Source whose values you transform
iteratee
Required. Function, or property-name string
context
Optional. Value of this for the iteratee
Return Value
Return Value
Description
*
New object; same keys, new values
Underscore.js Examples
Example 1 — Official: Add 5 to Each Value
The docs keep start and end, and bump each number by 5.
Underscore
_.mapObject({start: 5, end: 12}, function (val, key) {
return val + 5;
});
// → {start: 10, end: 17}
Rule of thumb. Need keys afterward? Prefer _.mapObject.
Compatibility
Browser & Runtime Support
_.mapObject ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore. There is no single native Object.map; this helper fills that gap.
✓ Stable · Underscore 1.x
_.mapObject()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.x
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
_.mapObjectUnderscore 1.x+
Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API by itself — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.mapObject(object, iteratee) runs the iteratee on each own enumerable value and returns a new object with the same keys and the transformed values. Official example: _.mapObject({start: 5, end: 12}, function (val) { return val + 5; }) returns {start: 10, end: 17}.
For each property, the iteratee is called as (value, key, object) — current value, its key, and the source object. An optional context can bind this.
_.map always returns an array, so mapping an object drops the keys. _.mapObject keeps the keys and returns a new object with the same shape.
No. It builds and returns a new object. The source stays unchanged.
Yes. A string iteratee acts like _.property: _.mapObject(obj, 'name') maps each value to value.name.
No. It is a stable Underscore object helper. Load Underscore 1.x (CDN or npm) and call _.mapObject(object, iteratee).