Skip to content

Commit 07575f3

Browse files
authored
fix: isPlainObject: add quick comparison between input and Object to short-circuit taxing Function.toString invocations (#805)
1 parent 5cb208b commit 07575f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export function isPlainObject(value: any): boolean {
4646
}
4747
const Ctor =
4848
Object.hasOwnProperty.call(proto, "constructor") && proto.constructor
49+
50+
if (Ctor === Object)
51+
return true
52+
4953
return (
5054
typeof Ctor == "function" &&
5155
Function.toString.call(Ctor) === objectCtorString

0 commit comments

Comments
 (0)