@@ -557,12 +557,11 @@ changes:
557557 (in combination with ` compact ` set to ` true ` or any number >= ` 1 ` ).
558558 ** Default:** ` 80 ` .
559559 * ` compact ` {boolean|integer} Setting this to ` false ` causes each object key
560- to be displayed on a new line. It will also add new lines to text that is
560+ to be displayed on a new line. It will break on new lines in text that is
561561 longer than ` breakLength ` . If set to a number, the most ` n ` inner elements
562562 are united on a single line as long as all properties fit into
563- ` breakLength ` . Short array elements are also grouped together. No
564- text will be reduced below 16 characters, no matter the ` breakLength ` size.
565- For more information, see the example below. ** Default:** ` 3 ` .
563+ ` breakLength ` . Short array elements are also grouped together. For more
564+ information, see the example below. ** Default:** ` 3 ` .
566565 * ` sorted ` {boolean|Function} If set to ` true ` or a function, all properties
567566 of an object, and ` Set ` and ` Map ` entries are sorted in the resulting
568567 string. If set to ` true ` the [ default sort] [ ] is used. If set to a function,
@@ -630,8 +629,8 @@ const util = require('util');
630629
631630const o = {
632631 a: [1 , 2 , [[
633- ' Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ' +
634- ' eiusmod tempor incididunt ut labore et dolore magna aliqua.' ,
632+ ' Lorem ipsum dolor sit amet,\n consectetur adipiscing elit, sed do ' +
633+ ' eiusmod \n tempor incididunt ut labore et dolore magna aliqua.' ,
635634 ' test' ,
636635 ' foo' ]], 4 ],
637636 b: new Map ([[' za' , 1 ], [' zb' , ' test' ]])
@@ -641,13 +640,13 @@ console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 }));
641640// { a:
642641// [ 1,
643642// 2,
644- // [ [ 'Lorem ipsum dolor sit amet, consectetur [...]', // A long line
643+ // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line
645644// 'test',
646645// 'foo' ] ],
647646// 4 ],
648647// b: Map(2) { 'za' => 1, 'zb' => 'test' } }
649648
650- // Setting `compact` to false changes the output to be more reader friendly.
649+ // Setting `compact` to false or an integer creates more reader friendly output .
651650console .log (util .inspect (o, { compact: false , depth: 5 , breakLength: 80 }));
652651
653652// {
@@ -656,10 +655,9 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
656655// 2,
657656// [
658657// [
659- // 'Lorem ipsum dolor sit amet, consectetur ' +
660- // 'adipiscing elit, sed do eiusmod tempor ' +
661- // 'incididunt ut labore et dolore magna ' +
662- // 'aliqua.,
658+ // 'Lorem ipsum dolor sit amet,\n' +
659+ // 'consectetur adipiscing elit, sed do eiusmod \n' +
660+ // 'tempor incididunt ut labore et dolore magna aliqua.',
663661// 'test',
664662// 'foo'
665663// ]
@@ -674,8 +672,6 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
674672
675673// Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a
676674// single line.
677- // Reducing the `breakLength` will split the "Lorem ipsum" text in smaller
678- // chunks.
679675```
680676
681677The ` showHidden ` option allows [ ` WeakMap ` ] [ ] and [ ` WeakSet ` ] [ ] entries to be
0 commit comments