The value to check.
Whether to allow a null
prototype. Defaults to true
.
true
if the check passes, false
otherwise.
isPlainObject({}) // true
isPlainObject(Object.create(Object.prototype)) // true
isPlainObject(Object.create(null)) // true
isPlainObject([]) // false
isPlainObject(Object.create({})) // false
class Foo {}
isPlainObject(new Foo()) // false
When allowNullProto
is false
:
// previously returned true
isPlainObject(Object.create(null), false) // false
Generated using TypeDoc
Checks if a value has a prototype of
Object.prototype
ornull
. To disallow anull
prototype, passfalse
toallowNullProto
.