diff --git a/lib/util.js b/lib/util.js index 3335faf3d8c51e..9a68ea0068cbf3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -575,13 +575,9 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { } if (str.indexOf('\n') > -1) { if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); + str = str.replace(/\n/g, '\n '); } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); + str = str.replace(/(^|\n)/g, '\n '); } } } else {