Skip to content

Commit df44a20

Browse files
committed
[Robustness] cache Object.prototype.toString
1 parent 7255034 commit df44a20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOw
77
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
88
var setForEach = hasSet && Set.prototype.forEach;
99
var booleanValueOf = Boolean.prototype.valueOf;
10+
var objectToString = Object.prototype.toString;
1011

1112
module.exports = function inspect_ (obj, opts, depth, seen) {
1213
if (!opts) opts = {};
@@ -151,7 +152,7 @@ function has (obj, key) {
151152
}
152153

153154
function toStr (obj) {
154-
return Object.prototype.toString.call(obj);
155+
return objectToString.call(obj);
155156
}
156157

157158
function nameOf (f) {

0 commit comments

Comments
 (0)