Check for a couple of edge cases on the inspect hook.
Don't treat sys.inspect special, same with prototype objects.
This commit is contained in:
parent
7f5320b167
commit
b480184fd6
@ -33,7 +33,12 @@ exports.inspect = function (obj, showHidden, depth) {
|
|||||||
var seen = [];
|
var seen = [];
|
||||||
function format(value, recurseTimes) {
|
function format(value, recurseTimes) {
|
||||||
// Provide a hook for user-specified inspect functions.
|
// Provide a hook for user-specified inspect functions.
|
||||||
if (value && typeof value.inspect === 'function') {
|
// Check that value is an object with an inspect function on it
|
||||||
|
if (value && typeof value.inspect === 'function' &&
|
||||||
|
// Filter out the sys module, it's inspect function is special
|
||||||
|
value !== exports &&
|
||||||
|
// Also filter out any prototype objects using the circular check.
|
||||||
|
!(value.constructor && value.constructor.prototype === value)) {
|
||||||
return value.inspect(recurseTimes);
|
return value.inspect(recurseTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user