main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
445 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * @param obj The object to inspect.
|
---|
3 | * @returns True if the argument appears to be a plain object.
|
---|
4 | */
|
---|
5 | export default function isPlainObject(obj: any): obj is object {
|
---|
6 | if (typeof obj !== 'object' || obj === null) return false
|
---|
7 |
|
---|
8 | let proto = obj
|
---|
9 | while (Object.getPrototypeOf(proto) !== null) {
|
---|
10 | proto = Object.getPrototypeOf(proto)
|
---|
11 | }
|
---|
12 |
|
---|
13 | return (
|
---|
14 | Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null
|
---|
15 | )
|
---|
16 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.