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 47747f329f
commit c38a0166c2

View File

@ -83,7 +83,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(' ');
};
/**