1.0.1 • Published 4 years ago
uinix-fp-is-plain-object v1.0.1
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-objectUse
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()); // falseAPI
This package exports the following identifiers: isPlainObject. There is no default export.
isPlainObject
Parameters
x(X) — Any value
Returns
boolean— Boolean value ifxis a plain JS object.