Skip to content

Commit 004e006

Browse files
Merge pull request #1 from bilalkhan13/bilalkhan13-patch-1
Update isPlainObject.ts
2 parents 7e6b201 + ddecb8b commit 004e006

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils/isPlainObject.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* @returns True if the argument appears to be a plain object.
44
*/
55
export default function isPlainObject(obj: any): boolean {
6-
return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;
7-
}
6+
if (typeof obj !== 'object' || obj === null) return false;
87

8+
const prototype = Object.getPrototypeOf(obj);
9+
return prototype === null || prototype === Object.prototype;
10+
}

0 commit comments

Comments
 (0)