diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-05 22:18:16 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-04-10 17:59:14 +0200 |
commit | c9fece38c8dc872303fd0f5d6bf0ffc44bea7f4f (patch) | |
tree | 173068b5a4f1dc81ad17b55d7b26300658ce8f0a /doc/api/util.md | |
parent | 892c51f330f99b7eb57481e183df61530a9c5956 (diff) | |
download | android-node-v8-c9fece38c8dc872303fd0f5d6bf0ffc44bea7f4f.tar.gz android-node-v8-c9fece38c8dc872303fd0f5d6bf0ffc44bea7f4f.tar.bz2 android-node-v8-c9fece38c8dc872303fd0f5d6bf0ffc44bea7f4f.zip |
util: change inspect compact and breakLength default
This changes the `compact` default from `true` to `3`. That mode
changes arrays to be grouped together, it alignes multiple small
entries on a single line in similar to `compact` true but only for
the most inner three depth levels and the closing brackets are
always on the same indentation as the openeing of the object instead
of at the same line as another property.
Big strings will be naturally broken into multiple lines instead of
having one huge line that is not well readable.
The output size mainly stays the same that way while it will be
smaller in case of big arrays.
Increasing the `breakLength` to 80 adjusts for most terminals that
support at least 80 characters in a single line and improves the
general output that way. A lot of calculations use the `breakLength`
to determine the concrete behavior.
PR-URL: https://github.com/nodejs/node/pull/27109
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'doc/api/util.md')
-rw-r--r-- | doc/api/util.md | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/api/util.md b/doc/api/util.md index 6a8b30ef7a..ceaa01d5b0 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -390,6 +390,10 @@ stream.write('With ES6'); <!-- YAML added: v0.3.0 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/27109 + description: The `compact` options default is changed to `3` and the + `breakLength` options default is changed to `80`. - version: v11.11.0 pr-url: https://github.com/nodejs/node/pull/26269 description: The `compact` option accepts numbers for a new output mode. @@ -463,16 +467,17 @@ changes: [`TypedArray`][], [`WeakMap`][] and [`WeakSet`][] elements to include when formatting. Set to `null` or `Infinity` to show all elements. Set to `0` or negative to show no elements. **Default:** `100`. - * `breakLength` {integer} The length at which an object's keys are split - across multiple lines. Set to `Infinity` to format an object as a single - line. **Default:** `60` for legacy compatibility. + * `breakLength` {integer} The length at which input values are split across + multiple lines. Set to `Infinity` to format the input as a single line + (in combination with `compact` set to `true` or any number >= `1`). + **Default:** `80`. * `compact` {boolean|integer} Setting this to `false` causes each object key to be displayed on a new line. It will also add new lines to text that is longer than `breakLength`. If set to a number, the most `n` inner elements are united on a single line as long as all properties fit into `breakLength`. Short array elements are also grouped together. Note that no text will be reduced below 16 characters, no matter the `breakLength` size. - For more information, see the example below. **Default:** `true`. + For more information, see the example below. **Default:** `3`. * `sorted` {boolean|Function} If set to `true` or a function, all properties of an object, and `Set` and `Map` entries are sorted in the resulting string. If set to `true` the [default sort][] is used. If set to a function, |