Lodash _.isMap() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is classified as a Map object. Part of Lodash Lang since 4.3.0 (stable — not deprecated).

Pass the value you want to inspect or convert. Read the return type carefully before you use the result.

Syntax

Call _.isMap. Start with this line.

Lodash
_.isMap(value)
CallWhat it does
_.isMap(value)Primary signature.

Prefer import isMap from "lodash/isMap" when you want a smaller bundle.

Library declarations
Lodash
_.isMap(value)

Parameters

ParameterDescription
valueRequired. The value to check

Return Value

Return ValueDescription
*true if Map, else false

Lodash Examples

Example 1 — Official: new Map

A real Map instance is classified as a Map.

Lodash
_.isMap(new Map);
// → true
Try It Yourself

How It Works

  1. Input. Official sample: new Map (empty Map).
  2. Brand. Engines tag it as [object Map].
  3. Result. true — it is a Map.
  4. Note. Emptiness does not matter; type does.

Example 2 — Official: new WeakMap

WeakMap is a different built-in — not a Map.

Lodash
_.isMap(new WeakMap);
// → false
Try It Yourself

How It Works

  1. Input. Official sample: new WeakMap.
  2. Different type. Brand is [object WeakMap].
  3. Result. false.
  4. Related. Use _.isWeakMap for WeakMaps.

Example 3 — Map With Entries

Populated Maps still pass — size is irrelevant.

Lodash
var m = new Map();
m.set("a", 1);
m.set("b", 2);

_.isMap(m);
// → true

_.isMap(new Map());
// → true
Try It Yourself

How It Works

  1. Build. Create a Map and add key/value pairs.
  2. Check. _.isMap(m) looks at type, not .size.
  3. Empty too. new Map() also returns true.
  4. Use. Guard before calling Map methods on unknown values.

Example 4 — Plain Object Is Not a Map

Objects and Maps both store keys, but only Map instances pass.

Lodash
_.isMap({ a: 1 });           // → false
_.isMap(Object.create(null)); // → false
_.isMap(new Map([["a", 1]])); // → true
Try It Yourself

How It Works

  1. Plain object. { a: 1 } is not a Map.
  2. Null proto. Object.create(null) also fails.
  3. Real Map. Built with new Map(...) → true.
  4. Related. Use _.isPlainObject for {}.

Example 5 — Set, Array, and Null

Other collections and nullish values are not Maps.

Lodash
_.isMap(new Set([1, 2])); // → false
_.isMap([1, 2]);           // → false
_.isMap(null);             // → false
_.isMap(undefined);        // → false
Try It Yourself

How It Works

  1. Set. Unique values collection — use _.isSet.
  2. Array. Indexed list — not a Map.
  3. Nullish. null / undefined fail cleanly.
  4. Rule. Only values branded as Map pass.

Browser & Runtime Support

_.isMap is a Lodash Lang helper (available since 4.3.0, stable in 4.x). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. The host must also provide the ES Map built-in (all evergreen engines do).

✓ Stable · Lodash 4.3.0+

_.isMap()

Available in [email protected] full builds and the lodash/isMap modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.x + Map
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.isMap Lodash 4.3.0+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import isMap from "lodash/isMap" for smaller builds. Native alternative: value instanceof Map (note iframe/realm caveats).

Frequently Asked Questions

_.isMap(value) returns true if value is classified as a Map object, otherwise false. WeakMap, plain objects, Sets, and arrays all return false.
WeakMap is a different built-in type with its own brand ([object WeakMap]). Lodash exposes _.isWeakMap for that check.
Yes. _.isMap(new Map()) is true whether the Map has entries or not — the check is about type, not size.
No. Duck-typed objects are not Maps. Lodash looks for a real Map classification, not method names.
Yes. Instances that brand as Map (including typical subclasses) return true.
Use import isMap from "lodash/isMap" or require("lodash/isMap"). Full build: import _ from "lodash" then _.isMap.

Next: _.isMatch()

Perform a partial deep comparison between an object and a source.

_.isMatch() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful