util: improve util inspect output by BridgeAR · Pull Request #26984 · nodejs/node (original) (raw)

@mcollina did you see the commit messages?

util: improve `inspect()` compact number mode

This fixes a proportion calculation for lots of short array entries
with at least one bigger one that alone makes up for more than one
fifth of all other entries together.

util: improve error property inspection

This makes sure that errors that contain extra properties show those
properties on a separate line.

Without the first commit the corresponding test would just create a single
line for each array entry instead of grouping them together.

Without the second commit the corresponding tests would not add a linebreak
in case an error has extra properties.

const err = new Error(); err.foo = true; console.log(err); // Only the last line:

// Before // at REPLServer.Interface._line (readline.js:675:8) foo: true }

// Now // at REPLServer.Interface._line (readline.js:675:8) // foo: true }