|
@ -26,7 +26,6 @@ exports.error = function (x) { |
|
|
exports.inspect = function (obj, showHidden) { |
|
|
exports.inspect = function (obj, showHidden) { |
|
|
var seen = []; |
|
|
var seen = []; |
|
|
function format(value) { |
|
|
function format(value) { |
|
|
var keys, visible_keys, base, type, braces; |
|
|
|
|
|
// Primitive types cannot have properties
|
|
|
// Primitive types cannot have properties
|
|
|
switch (typeof value) { |
|
|
switch (typeof value) { |
|
|
case 'undefined': return 'undefined'; |
|
|
case 'undefined': return 'undefined'; |
|
@ -40,10 +39,10 @@ exports.inspect = function (obj, showHidden) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Look up the keys of the object.
|
|
|
// Look up the keys of the object.
|
|
|
keys = showHidden ? Object.getOwnPropertyNames(value).map(function (key) { |
|
|
var keys = showHidden ? Object.getOwnPropertyNames(value).map(function (key) { |
|
|
return '' + key; |
|
|
return '' + key; |
|
|
}) : Object.keys(value); |
|
|
}) : Object.keys(value); |
|
|
visible_keys = Object.keys(value); |
|
|
var visible_keys = Object.keys(value); |
|
|
|
|
|
|
|
|
// Functions without properties can be shortcutted.
|
|
|
// Functions without properties can be shortcutted.
|
|
|
if (typeof value === 'function' && keys.length === 0) { |
|
|
if (typeof value === 'function' && keys.length === 0) { |
|
@ -54,6 +53,7 @@ exports.inspect = function (obj, showHidden) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var base, type, braces; |
|
|
// Determine the object type
|
|
|
// Determine the object type
|
|
|
if (value instanceof Array) { |
|
|
if (value instanceof Array) { |
|
|
type = 'Array'; |
|
|
type = 'Array'; |
|
@ -160,4 +160,3 @@ exports.exec = function (command) { |
|
|
*/ |
|
|
*/ |
|
|
exports.inherits = process.inherits; |
|
|
exports.inherits = process.inherits; |
|
|
|
|
|
|
|
|
// Object.create(null, {name: {value: "Tim", enumerable: true}})
|
|
|
|