is-plain-object
Returns true if an object was created by the `Object` constructor, or Object.create(null).
Last updated 3 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install is-plain-object 
SYNC missed versions from official npm registry.

is-plain-object

npm version npm downloads CI

Returns true if an object was created by the Object constructor or with a null prototype.

Please consider following this project's author, Jon Schlinkert, and starring the project to show your ❤️ and support.

Use isobject if you only want to check whether a value is an object and not an array or null.

Install

npm install is-plain-object

Usage

With ES modules:

import { isPlainObject } from 'is-plain-object';

isPlainObject({});                        // true
isPlainObject({ foo: 'bar' });            // true
isPlainObject(Object.create(null));       // true
isPlainObject(Object.create({}));         // true

isPlainObject();                          // false
isPlainObject(null);                      // false
isPlainObject([]);                        // false
isPlainObject(new Date());                // false
isPlainObject(/foo/);                     // false
isPlainObject(() => {});                  // false

With CommonJS:

const { isPlainObject } = require('is-plain-object');

API

isPlainObject(value)

Returns true when value is a plain object. Objects created by the Object constructor and objects with a null prototype are considered plain.

Development

Install dependencies, build the CommonJS and ES module bundles, and run the tests:

npm install
npm run build
npm test

Related projects

  • is-number: Check if a value is a finite number.
  • isobject: Check if a value is an object and not an array or null.
  • kind-of: Get the native type of a value.

License

MIT © Jon Schlinkert

Current Tags

  • 5.1.0                                ...           latest (3 months ago)

14 Versions

  • 5.1.0                                ...           3 months ago
  • 5.0.0                                ...           6 years ago
  • 4.1.1                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.4                                ...           9 years ago
  • 2.0.3                                ...           9 years ago
  • 2.0.2                                ...           10 years ago
  • 2.0.1                                ...           11 years ago
  • 2.0.0                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE