bypass getter in console.log()

This commit is contained in:
alexlamsl 2017-05-14 00:57:46 +08:00
parent 74207501c4
commit c5c5f1f0da

View File

@ -8,9 +8,11 @@ function safe_log(arg, level) {
if (/Error$/.test(arg.name)) return arg.toString();
arg.constructor.toString();
if (level--) for (var key in arg) {
if (!Object.getOwnPropertyDescriptor(arg, key).get) {
arg[key] = safe_log(arg[key], level);
}
}
}
return arg;
}