uinix-fp-is-plain-object
v1.0.1
Published
uinix fp utility to test if a value is a plain JS object
Downloads
9
Maintainers
Readme
uinix-fp-is-plain-object
uinix-fp
utility to test if a value is a plain JS object.
Install
This package is ESM-only and requires Node 12+.
npm install uinix-fp-is-plain-object
Use
isPlainObject
is a predicate testing if a value is a plain JS object.
An object is plain if it is created by either
{}
,new Object()
, orObject.create(null)
.
import {isPlainObject} from 'uinix-fp-is-plain-object';
isPlainObject({foo: 'bar'}); // true
isPlainObject(new Object()); // true
isPlainObject(Object.create(null)); // true
isPlainObject([1, 2, 3]); // false
class MyClass {}
isPlainObject(new MyClass()); // false
API
This package exports the following identifiers: isPlainObject
. There is no default export.
isPlainObject
Parameters
x
(X
) — Any value
Returns
boolean
— Boolean value ifx
is a plain JS object.