Skip to content

Instantly share code, notes, and snippets.

@barik
Created July 21, 2012 03:38
Show Gist options
  • Save barik/3154490 to your computer and use it in GitHub Desktop.
Save barik/3154490 to your computer and use it in GitHub Desktop.
v8
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (typeof value === 'function') {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment