|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
449 bytes
|
| Line | |
|---|
| 1 | function isPlainObject(value) {
|
|---|
| 2 | if (!value || typeof value !== 'object') {
|
|---|
| 3 | return false;
|
|---|
| 4 | }
|
|---|
| 5 | const proto = Object.getPrototypeOf(value);
|
|---|
| 6 | const hasObjectPrototype = proto === null ||
|
|---|
| 7 | proto === Object.prototype ||
|
|---|
| 8 | Object.getPrototypeOf(proto) === null;
|
|---|
| 9 | if (!hasObjectPrototype) {
|
|---|
| 10 | return false;
|
|---|
| 11 | }
|
|---|
| 12 | return Object.prototype.toString.call(value) === '[object Object]';
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | export { isPlainObject };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.