Skip to content
Myr

fix: isPlainObject: add quick comparison between input and `Object` to short-circuit taxing `Function.toString` invocations (#805)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ben Elliott · committed by GitHub · parent 5cb208b · Browse files · 1 file+4 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−0 removed

  • other:+4 added−0 removed

1 file+4 added−0 removed

modified:src/utils/common.ts+4 added
44 unmodified lines
45 return true46 }47 const Ctor =48 Object.hasOwnProperty.call(proto, "constructor") && proto.constructor4950 if (Ctor === Object)51 return true5253 return (54 typeof Ctor == "function" &&55 Function.toString.call(Ctor) === objectCtorString56 )
165 unmodified lines