Lodash _.isPlainObject() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Lang

Definition

Checks if value is a plain object — created by the Object constructor, or one with a [[Prototype]] of null. Part of Lodash Lang (stable — not deprecated). Note: class instances, arrays, dates, and other builtins return false.

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

Syntax

Call _.isPlainObject. Start with this line.

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

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

Library declarations
Lodash
_.isPlainObject(value)

Parameters

ParameterDescription
valueRequired. Value to check

Return Value

Return ValueDescription
*true if plain object, else false

Lodash Examples

Example 1 — Official: Instances, Arrays, Literals, Null Proto

Only plain dictionaries pass.

Lodash
function Foo() {
  this.a = 1;
}

console.log(_.isPlainObject(new Foo));             // false
console.log(_.isPlainObject([1, 2, 3]));           // false
console.log(_.isPlainObject({ x: 0, y: 0 }));      // true
console.log(_.isPlainObject(Object.create(null))); // true
Try It Yourself

How It Works

  1. Foo instance. Prototype is Foo.prototype → not plain.
  2. Array. Built-in array type → false.
  3. Literal. Created by Object → true.
  4. Null proto. Official: still treated as a plain record → true.

Example 2 — Class / Constructor Instances Fail

Looks like a bag of fields, but the prototype marks it as a class.

Lodash
function Person(name) {
  this.name = name;
}

var p = new Person("Ada");

console.log(_.isObjectLike(p));   // true
console.log(_.isPlainObject(p));  // false
console.log(_.isPlainObject({ name: "Ada" })); // true
Try It Yourself

How It Works

  1. Object-like. Instance is typeof object → isObjectLike is true.
  2. Prototype. Linked to Person.prototype → not plain.
  3. Literal twin. Same fields as a literal → plain true.
  4. Use. Distinguish domain models from config hashes.

Example 3 — Object.create(null) Is Plain

Prototype-less dictionaries are accepted on purpose.

Lodash
var dict = Object.create(null);
dict.token = "abc";

console.log(Object.getPrototypeOf(dict)); // null
console.log(_.isPlainObject(dict));       // true
console.log(_.isPlainObject({}));         // true
Try It Yourself

How It Works

  1. Create. Object.create(null) builds a map-like object.
  2. Proto. Prototype is exactly null.
  3. Plain. Lodash counts that as a plain object.
  4. Same as {}. Object literals also pass.

Example 4 — isPlainObject vs isObjectLike

Object-like is wider; plain is the narrow config-bag check.

Lodash
console.log(_.isObjectLike([1, 2]));      // true
console.log(_.isPlainObject([1, 2]));     // false

console.log(_.isObjectLike(new Date()));  // true
console.log(_.isPlainObject(new Date())); // false

console.log(_.isObjectLike({ a: 1 }));    // true
console.log(_.isPlainObject({ a: 1 }));   // true
Try It Yourself

How It Works

  1. Array / Date. typeof object → object-like; not plain.
  2. Literal. Both helpers agree → true.
  3. Pick. Need any object shell? isObjectLike. Need a POJO? isPlainObject.
  4. Safer merges. Plain checks avoid merging arrays or dates as options.

Example 5 — Guard Options Before Merge

Accept only plain option bags; ignore invalid inputs.

Lodash
function mergeOptions(defaults, options) {
  if (!_.isPlainObject(options)) {
    return defaults;
  }
  return _.assign({}, defaults, options);
}

console.log(mergeOptions({ a: 1 }, { a: 2 })); // { a: 2 }
console.log(mergeOptions({ a: 1 }, [9]));      // { a: 1 }
console.log(mergeOptions({ a: 1 }, null));     // { a: 1 }
Try It Yourself

How It Works

  1. Plain options. Object literal merges over defaults.
  2. Array. Not plain → return defaults unchanged.
  3. null. Not plain → same safe fallback.
  4. Why. Prevents accidental merges of non-config values.

Browser & Runtime Support

_.isPlainObject is a Lodash Lang helper available in 4.x (and earlier builds). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native engines have no single equivalent; people often approximate with prototype checks.

✓ Stable · Lodash 4.x

_.isPlainObject()

Available in [email protected] full builds and the lodash/isPlainObject 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
_.isPlainObject Lodash 4.x

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import isPlainObject from "lodash/isPlainObject" for smaller builds. Ideal for validating options / config objects.

Frequently Asked Questions

_.isPlainObject(value) returns true when value is a plain object — created by the Object constructor, or one whose [[Prototype]] is null. Class instances, arrays, dates, and other builtins return false.
Custom constructors set the prototype to Foo.prototype, not Object.prototype. Lodash treats that as a class instance, not a plain dictionary.
Yes. Official docs: _.isPlainObject(Object.create(null)) is true — a null-prototype dictionary is still a plain record.
No. _.isObject is broad (arrays and functions pass). _.isPlainObject only accepts simple records that look like config bags or JSON-style hashes.
isObjectLike accepts any non-null typeof object value (arrays, dates, regexes). isPlainObject rejects those and keeps only plain dictionaries.
Use import isPlainObject from "lodash/isPlainObject" or require("lodash/isPlainObject") so bundlers can tree-shake unused Lodash code. Full build: import _ from "lodash" then _.isPlainObject.

Next: _.isRegExp()

Check whether a value is classified as a RegExp.

_.isRegExp() 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