Lodash _.isEmpty() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is an empty object, collection, map, or set. Array-likes and strings use length === 0; maps and sets use size === 0; objects need no own enumerable string keys. Since Lodash 0.1.0.

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

Syntax

Call _.isEmpty. Start with this line.

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

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

Library declarations
Lodash
_.isEmpty(value)

Parameters

ParameterDescription
valueRequired. The value to check

Return Value

Return ValueDescription
*true if empty, else false

Lodash Examples

Example 1 — Official: null, true, 1

Nullish and many primitives count as empty.

Lodash
_.isEmpty(null);
// → true

_.isEmpty(true);
// → true

_.isEmpty(1);
// → true
Try It Yourself

How It Works

  1. null is treated as empty.
  2. true / 1 are not collections with keys or length.
  3. Result. All three → true.
  4. Tip. Guard with _.isObject / _.isArray if you only want collections.

Example 2 — Official: Non-Empty Array and Object

Content in length or keys means not empty.

Lodash
_.isEmpty([1, 2, 3]);
// → false

_.isEmpty({ a: 1 });
// → false
Try It Yourself

How It Works

  1. Array length is 3 → not empty.
  2. Object has own key "a" → not empty.
  3. Result. Both false.
  4. Same idea for non-empty strings and Maps.

Example 3 — Empty Array, String, Object

The everyday “no content” shapes.

Lodash
_.isEmpty([]);
// → true

_.isEmpty("");
// → true

_.isEmpty({});
// → true
Try It Yourself

How It Works

  1. [] → length 0.
  2. "" → length 0.
  3. {} → no own enumerable keys.
  4. Note. [] is truthy in JS but empty for Lodash.

Example 4 — Map and Set

Emptiness uses size, not object keys.

Lodash
_.isEmpty(new Map());
// → true

_.isEmpty(new Set([1]));
// → false
Try It Yourself

How It Works

  1. Empty Map → size === 0 → empty.
  2. Set([1]) → size 1 → not empty.
  3. Lodash detects Map/Set by object tag.
  4. Same rule for empty vs non-empty Maps.

Example 5 — Whitespace and Falsy Confusion

Spaces are not empty; empty arrays are not falsy.

Lodash
_.isEmpty(" ");
// → false   // length 1

_.isEmpty([]);
// → true

Boolean([]);
// → true    // truthy but empty
Try It Yourself

How It Works

  1. " " has length → not empty.
  2. [] is empty for Lodash.
  3. Boolean([]) is still true in JS.
  4. Trim strings before treating blanks as empty.

Browser & Runtime Support

_.isEmpty is a Lodash Lang helper (since 0.1.0). It runs anywhere Lodash 4.x runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Map/Set emptiness works wherever those built-ins exist.

✓ Stable · Lodash 0.1.0+

_.isEmpty()

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

100% With Lodash 4.x
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
_.isEmpty Lodash 0.1.0+

Bottom line: Safe for production once Lodash is loaded. Prefer import isEmpty from "lodash/isEmpty" for smaller builds.

Frequently Asked Questions

_.isEmpty(value) returns true if value is an empty object, collection, map, or set. Array-likes and strings use length === 0; maps/sets use size === 0; objects need no own enumerable string keys.
No. Emptiness is about structure (length, size, keys). Falsy is a JavaScript coercion rule. [] is truthy but empty; 0 is falsy and also empty for isEmpty.
Numbers and booleans are not collections in Lodash’s branching — they are treated as empty non-collections. Check typeof or _.isNumber / _.isBoolean if you need to exclude them.
No. " " has length 1, so _.isEmpty returns false. Trim first if you want blank-looking strings to count as empty.
Yes. Lodash checks size === 0 for Map and Set instances.
Use import isEmpty from "lodash/isEmpty" or require("lodash/isEmpty") for tree-shaking. Full build: import _ from "lodash" then _.isEmpty.

Next: _.isEqual()

Deep-compare values — objects, arrays, maps, sets, and more.

_.isEqual() tutorial →

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.

11 people found this page helpful