|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
567 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | Check if a value is a plain object.
|
|---|
| 3 |
|
|---|
| 4 | An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
|---|
| 5 |
|
|---|
| 6 | @example
|
|---|
| 7 | ```
|
|---|
| 8 | import isPlainObject = require('is-plain-obj');
|
|---|
| 9 |
|
|---|
| 10 | isPlainObject({foo: 'bar'});
|
|---|
| 11 | //=> true
|
|---|
| 12 |
|
|---|
| 13 | isPlainObject(new Object());
|
|---|
| 14 | //=> true
|
|---|
| 15 |
|
|---|
| 16 | isPlainObject(Object.create(null));
|
|---|
| 17 | //=> true
|
|---|
| 18 |
|
|---|
| 19 | isPlainObject([1, 2, 3]);
|
|---|
| 20 | //=> false
|
|---|
| 21 |
|
|---|
| 22 | class Unicorn {}
|
|---|
| 23 | isPlainObject(new Unicorn());
|
|---|
| 24 | //=> false
|
|---|
| 25 | ```
|
|---|
| 26 | */
|
|---|
| 27 | declare function isPlainObject<Value = unknown>(value: unknown): value is Record<string | number | symbol, Value>;
|
|---|
| 28 |
|
|---|
| 29 | export = isPlainObject;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.