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