util.inspect short arrays still end up being distributed on new lines #5040

Closed
FTPlus opened this Issue Mar 16, 2013 · 1 comment

Projects

None yet

2 participants

@FTPlus
FTPlus commented Mar 16, 2013

When using util.inspect with colored output relatively small arrays and objects still end up on multiple lines. I guess this is caused by the fact that the color-codes are also included in the line width calculation.

example case:

 // Ends up on a single line as intended:
console.log(require('util').inspect([1,2,3,4,5,6], {colors: false}))
// Is split up over multiple lines:
console.log(require('util').inspect([1,2,3,4,5,6], {colors: true})) 

It's not really a vital problem but it makes printing larges objects much more readable. Maybe a regexp to strip out the color-codes when calculating the line width would do the trick?

edit: Sorry for the double post; it gave me a 404 :(

@bnoordhuis
Member

Duplicate of #5039.

@bnoordhuis bnoordhuis closed this Mar 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment