Skip to content

Commit 82b75d6

Browse files
committed
Merge pull request #942 from matthewtff/cache-object-string-value
Cached Object string representation
2 parents 9b00b02 + 28c80b8 commit 82b75d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/isPlainObject.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var fnToString = (fn) => Function.prototype.toString.call(fn);
2+
var objStringValue = fnToString(Object);
23

34
/**
45
* @param {any} obj The object to inspect.
@@ -19,5 +20,5 @@ export default function isPlainObject(obj) {
1920

2021
return typeof constructor === 'function'
2122
&& constructor instanceof constructor
22-
&& fnToString(constructor) === fnToString(Object);
23+
&& fnToString(constructor) === objStringValue;
2324
}

0 commit comments

Comments
 (0)