source: node_modules/is-plain-object/README.md

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 4.3 KB
Line 
1# is-plain-object [![NPM version](https://img.shields.io/npm/v/is-plain-object.svg?style=flat)](https://www.npmjs.com/package/is-plain-object) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![NPM total downloads](https://img.shields.io/npm/dt/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-plain-object.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-plain-object)
2
3> Returns true if an object was created by the `Object` constructor, or Object.create(null).
4
5Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7## Install
8
9Install with [npm](https://www.npmjs.com/):
10
11```sh
12$ npm install --save is-plain-object
13```
14
15Use [isobject](https://github.com/jonschlinkert/isobject) if you only want to check if the value is an object and not an array or null.
16
17## Usage
18
19with es modules
20```js
21import { isPlainObject } from 'is-plain-object';
22```
23
24or with commonjs
25```js
26const { isPlainObject } = require('is-plain-object');
27```
28
29**true** when created by the `Object` constructor, or Object.create(null).
30
31```js
32isPlainObject(Object.create({}));
33//=> true
34isPlainObject(Object.create(Object.prototype));
35//=> true
36isPlainObject({foo: 'bar'});
37//=> true
38isPlainObject({});
39//=> true
40isPlainObject(null);
41//=> true
42```
43
44**false** when not created by the `Object` constructor.
45
46```js
47isPlainObject(1);
48//=> false
49isPlainObject(['foo', 'bar']);
50//=> false
51isPlainObject([]);
52//=> false
53isPlainObject(new Foo);
54//=> false
55isPlainObject(Object.create(null));
56//=> false
57```
58
59## About
60
61<details>
62<summary><strong>Contributing</strong></summary>
63
64Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
65
66</details>
67
68<details>
69<summary><strong>Running Tests</strong></summary>
70
71Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
72
73```sh
74$ npm install && npm test
75```
76
77</details>
78
79<details>
80<summary><strong>Building docs</strong></summary>
81
82_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
83
84To generate the readme, run the following command:
85
86```sh
87$ npm install -g verbose/verb#dev verb-generate-readme && verb
88```
89
90</details>
91
92### Related projects
93
94You might also be interested in these projects:
95
96* [is-number](https://www.npmjs.com/package/is-number): Returns true if a number or string value is a finite number. Useful for regex… [more](https://github.com/jonschlinkert/is-number) | [homepage](https://github.com/jonschlinkert/is-number "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.")
97* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
98* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
99
100### Contributors
101
102| **Commits** | **Contributor** |
103| --- | --- |
104| 19 | [jonschlinkert](https://github.com/jonschlinkert) |
105| 6 | [TrySound](https://github.com/TrySound) |
106| 6 | [stevenvachon](https://github.com/stevenvachon) |
107| 3 | [onokumus](https://github.com/onokumus) |
108| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
109
110### Author
111
112**Jon Schlinkert**
113
114* [GitHub Profile](https://github.com/jonschlinkert)
115* [Twitter Profile](https://twitter.com/jonschlinkert)
116* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
117
118### License
119
120Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
121Released under the [MIT License](LICENSE).
122
123***
124
125_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._
Note: See TracBrowser for help on using the repository browser.