Returns true if an object was created by the `Object` constructor, or Object.create(null)
npm install @mogeko/is-plain-object> Returns true if an object was created by the Object constructor, or Object.create(null).
This project originated from is-plain-object (released under MIT license). I reimplemented it by TypeScript.
With ES modules:
``ts`
import { isPlainObject } from "is-plain-object";
true when created by the Object constructor, or Object.create(null).
`ts`
isPlainObject(Object.create({})); // => true
isPlainObject(Object.create(Object.prototype)); // => true
isPlainObject({ foo: "bar" }); // => true
isPlainObject({}); // => true
isPlainObject(Object.create(null)); // => true
false when not created by the Object constructor.
`ts``
isPlainObject(["foo", "bar"]); // => false
isPlainObject([]); // => false
isPlainObject(new Foo()); // => false
The original project is released under the MIT License.
The code in this project is released under the MIT License.