0.0.3 • Published 10 months ago

@mogeko/is-plain-object v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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.

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)); // => true

false when not created by the Object constructor.

isPlainObject(["foo", "bar"]); // => false
isPlainObject([]); // => false
isPlainObject(new Foo()); // => false

License

The original project is released under the MIT License.

The code in this project is released under the MIT License.

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago