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.
typeof
undefined
1 parent 81edd34 commit 5ca6f60Copy full SHA for 5ca6f60
index.js
@@ -11,14 +11,14 @@ var objectToString = Object.prototype.toString;
11
12
module.exports = function inspect_ (obj, opts, depth, seen) {
13
if (!opts) opts = {};
14
-
15
- var maxDepth = opts.depth === undefined ? 5 : opts.depth;
16
- if (depth === undefined) depth = 0;
+
+ var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
+ if (typeof depth === 'undefined') depth = 0;
17
if (depth >= maxDepth && maxDepth > 0 && obj && typeof obj === 'object') {
18
return '[Object]';
19
}
20
21
- if (seen === undefined) seen = [];
+ if (typeof seen === 'undefined') seen = [];
22
else if (indexOf(seen, obj) >= 0) {
23
return '[Circular]';
24
0 commit comments