_.isMap ships with Underscore.js from 1.9.0. It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore. The host must also support ES2015 Map.
✓ Stable · Underscore 1.9.0+
_.isMap()
Available since [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded and Map exists.
100%With Underscore 1.9+
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
_.isMapUnderscore 1.9.0+
Bottom line: Safe for production once Underscore ≥ 1.9.0 is loaded and the runtime supports Map. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.isMap(object) returns true only when the value is a Map — new Map() or a Map that already has entries. Strings, numbers, plain objects, arrays, Set, WeakMap, null, and undefined return false.
_.isMap(new Map()) returns true. The docs pick a real Map instance on purpose: that is the type the helper looks for.
No. {} is a dictionary-like object, but it is not a Map. Underscore's tests say an object is not a map. Only values tagged [object Map] pass.
No. Underscore's tests say a set is not a map and a weakmap is not a map. Use the matching helper for each collection type.
typeof new Map() is "object", so typeof is too broad. instanceof Map usually agrees in the same window. Underscore uses the [object Map] tag, which is more consistent across iframes than instanceof.
No. It is a stable Underscore helper added in version 1.9.0. Use it to decide whether a value is a Map before you call set, get, or has.