_.isPlainObject

_.isPlainObject(value)

Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

Since

0.8.0

Arguments

  1. value (*): The value to check.

Returns

(boolean): Returns true if value is a plain object, else false.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function Foo() {
  this.a = 1;
}
  
_.isPlainObject(new Foo);
// => false
  
_.isPlainObject([1, 2, 3]);
// => false
  
_.isPlainObject({ 'x': 0, 'y': 0 });
// => true
  
_.isPlainObject(Object.create(null));
// => true
doc_Lodash
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.