|
@ -175,6 +175,17 @@ function stylizeNoColor(str, styleType) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function arrayToHash(array) { |
|
|
|
|
|
var hash = {}; |
|
|
|
|
|
|
|
|
|
|
|
array.forEach(function(val, idx) { |
|
|
|
|
|
hash[val] = true; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return hash; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
@ -193,8 +204,12 @@ function formatValue(ctx, value, recurseTimes) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Look up the keys of the object.
|
|
|
// Look up the keys of the object.
|
|
|
var visibleKeys = Object.keys(value); |
|
|
var keys = Object.keys(value); |
|
|
var keys = ctx.showHidden ? Object.getOwnPropertyNames(value) : visibleKeys; |
|
|
var visibleKeys = arrayToHash(keys); |
|
|
|
|
|
|
|
|
|
|
|
if (ctx.showHidden) { |
|
|
|
|
|
keys = Object.getOwnPropertyNames(value); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Some type of object without properties can be shortcutted.
|
|
|
// Some type of object without properties can be shortcutted.
|
|
|
if (keys.length === 0) { |
|
|
if (keys.length === 0) { |
|
@ -334,7 +349,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { |
|
|
str = ctx.stylize('[Setter]', 'special'); |
|
|
str = ctx.stylize('[Setter]', 'special'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (visibleKeys.indexOf(key) < 0) { |
|
|
if (!visibleKeys.hasOwnProperty(key)) { |
|
|
name = '[' + key + ']'; |
|
|
name = '[' + key + ']'; |
|
|
} |
|
|
} |
|
|
if (!str) { |
|
|
if (!str) { |
|
|