|
@ -132,6 +132,7 @@ function inspect(obj, opts/* legacy: showHidden, depth, colors*/) { |
|
|
if (typeof ctx.showHidden === 'undefined') ctx.showHidden = false; |
|
|
if (typeof ctx.showHidden === 'undefined') ctx.showHidden = false; |
|
|
if (typeof ctx.depth === 'undefined') ctx.depth = 2; |
|
|
if (typeof ctx.depth === 'undefined') ctx.depth = 2; |
|
|
if (typeof ctx.colors === 'undefined') ctx.colors = false; |
|
|
if (typeof ctx.colors === 'undefined') ctx.colors = false; |
|
|
|
|
|
if (typeof ctx.customInspect === 'undefined') ctx.customInspect = true; |
|
|
if (ctx.colors) ctx.stylize = stylizeWithColor; |
|
|
if (ctx.colors) ctx.stylize = stylizeWithColor; |
|
|
return formatValue(ctx, obj, ctx.depth); |
|
|
return formatValue(ctx, obj, ctx.depth); |
|
|
} |
|
|
} |
|
@ -200,7 +201,7 @@ function arrayToHash(array) { |
|
|
function formatValue(ctx, value, recurseTimes) { |
|
|
function formatValue(ctx, value, recurseTimes) { |
|
|
// Provide a hook for user-specified inspect functions.
|
|
|
// Provide a hook for user-specified inspect functions.
|
|
|
// Check that value is an object with an inspect function on it
|
|
|
// Check that value is an object with an inspect function on it
|
|
|
if (value && typeof value.inspect === 'function' && |
|
|
if (ctx.customInspect && value && typeof value.inspect === 'function' && |
|
|
// Filter out the util module, it's inspect function is special
|
|
|
// Filter out the util module, it's inspect function is special
|
|
|
value.inspect !== exports.inspect && |
|
|
value.inspect !== exports.inspect && |
|
|
// Also filter out any prototype objects using the circular check.
|
|
|
// Also filter out any prototype objects using the circular check.
|
|
|