remove ReDoS regexp in %o formatter (#504)

This commit is contained in:
Ya Zhuang 2017-09-22 06:26:33 +08:00 committed by Nathan Rajlich
parent 52e1f21284
commit f53962e944

View File

@ -85,7 +85,9 @@ function useColors() {
exports.formatters.o = function(v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.replace(/\s*\n\s*/g, ' ');
.split('\n').map(function(str) {
return str.trim()
}).join(' ');
};
/**