Browse Source

Provide a hook for user-specified inspect functions

v0.7.4-release
Tim Caswell 15 years ago
committed by Ryan Dahl
parent
commit
7f5320b167
  1. 5
      lib/sys.js

5
lib/sys.js

@ -32,6 +32,11 @@ var error = exports.error = function (x) {
exports.inspect = function (obj, showHidden, depth) {
var seen = [];
function format(value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
if (value && typeof value.inspect === 'function') {
return value.inspect(recurseTimes);
}
// Primitive types cannot have properties
switch (typeof value) {
case 'undefined': return 'undefined';

Loading…
Cancel
Save