1
0
Fork 0

Pretty print classes in console

This commit is contained in:
Alan Plum 2015-09-19 05:03:45 +02:00
parent fb2d334741
commit 47a06b1fdc
1 changed files with 10 additions and 2 deletions

View File

@ -1226,6 +1226,7 @@ function printObject (object, context) {
var funcRE = /function ([^\(]*)?\(\) \{ \[native code\] \}/;
var func2RE = /function ([^\(]*)?\((.*)\) \{/;
var classRE = /class ([^{]*)? \{/;
exports.printRecursive = printRecursive = function (value, context) {
@ -1321,8 +1322,15 @@ exports.printRecursive = printRecursive = function (value, context) {
}
}
else {
f = f.substr(8, f.length - 10).trim();
context.output += '[Function "' + f + '" ...]';
m = classRE.exec(f);
if (m !== null) {
context.output += 'class ' + m[1] + ' { ... }';
}
else {
f = f.substr(8, f.length - 10).trim();
context.output += '[Function "' + f + '" ...]';
}
}
}
}