|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | # is-plain-obj [](https://travis-ci.com/github/sindresorhus/is-plain-obj)
|
|---|
| 2 |
|
|---|
| 3 | > Check if a value is a plain object
|
|---|
| 4 |
|
|---|
| 5 | An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
|---|
| 6 |
|
|---|
| 7 | ## Install
|
|---|
| 8 |
|
|---|
| 9 | ```
|
|---|
| 10 | $ npm install is-plain-obj
|
|---|
| 11 | ```
|
|---|
| 12 |
|
|---|
| 13 | ## Usage
|
|---|
| 14 |
|
|---|
| 15 | ```js
|
|---|
| 16 | const isPlainObject = require('is-plain-obj');
|
|---|
| 17 |
|
|---|
| 18 | isPlainObject({foo: 'bar'});
|
|---|
| 19 | //=> true
|
|---|
| 20 |
|
|---|
| 21 | isPlainObject(new Object());
|
|---|
| 22 | //=> true
|
|---|
| 23 |
|
|---|
| 24 | isPlainObject(Object.create(null));
|
|---|
| 25 | //=> true
|
|---|
| 26 |
|
|---|
| 27 | isPlainObject([1, 2, 3]);
|
|---|
| 28 | //=> false
|
|---|
| 29 |
|
|---|
| 30 | class Unicorn {}
|
|---|
| 31 | isPlainObject(new Unicorn());
|
|---|
| 32 | //=> false
|
|---|
| 33 | ```
|
|---|
| 34 |
|
|---|
| 35 | ## Related
|
|---|
| 36 |
|
|---|
| 37 | - [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object
|
|---|
| 38 | - [is](https://github.com/sindresorhus/is) - Type check values
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | ---
|
|---|
| 42 |
|
|---|
| 43 | <div align="center">
|
|---|
| 44 | <b>
|
|---|
| 45 | <a href="https://tidelift.com/subscription/pkg/npm-is-plain-obj?utm_source=npm-is-plain-obj&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|---|
| 46 | </b>
|
|---|
| 47 | <br>
|
|---|
| 48 | <sub>
|
|---|
| 49 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|---|
| 50 | </sub>
|
|---|
| 51 | </div>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.