We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7e6b201 + ddecb8b commit 004e006Copy full SHA for 004e006
src/utils/isPlainObject.ts
@@ -3,6 +3,8 @@
3
* @returns True if the argument appears to be a plain object.
4
*/
5
export default function isPlainObject(obj: any): boolean {
6
- return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;
7
-}
+ if (typeof obj !== 'object' || obj === null) return false;
8
+ const prototype = Object.getPrototypeOf(obj);
9
+ return prototype === null || prototype === Object.prototype;
10
+}
0 commit comments