uinix-fp-is-plain-object
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

uinix-fp-is-plain-object

Build Coverage Downloads Size

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(), or Object.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 if x is a plain JS object.

License

MIT © Chris Zhou

Package Sidebar

Install

npm i uinix-fp-is-plain-object

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

2.96 kB

Total Files

4

Last publish

Collaborators

  • chrisrzhou