@@ -576,12 +576,11 @@ changes:
576
576
(in combination with ` compact ` set to ` true ` or any number >= ` 1 ` ).
577
577
** Default:** ` 80 ` .
578
578
* ` compact ` {boolean|integer} Setting this to ` false ` causes each object key
579
- to be displayed on a new line. It will also add new lines to text that is
579
+ to be displayed on a new line. It will break on new lines in text that is
580
580
longer than ` breakLength ` . If set to a number, the most ` n ` inner elements
581
581
are united on a single line as long as all properties fit into
582
- ` breakLength ` . Short array elements are also grouped together. No
583
- text will be reduced below 16 characters, no matter the ` breakLength ` size.
584
- For more information, see the example below. ** Default:** ` 3 ` .
582
+ ` breakLength ` . Short array elements are also grouped together. For more
583
+ information, see the example below. ** Default:** ` 3 ` .
585
584
* ` sorted ` {boolean|Function} If set to ` true ` or a function, all properties
586
585
of an object, and ` Set ` and ` Map ` entries are sorted in the resulting
587
586
string. If set to ` true ` the [ default sort] [ ] is used. If set to a function,
@@ -649,8 +648,8 @@ const util = require('util');
649
648
650
649
const o = {
651
650
a: [1 , 2 , [[
652
- ' Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ' +
653
- ' eiusmod tempor incididunt ut labore et dolore magna aliqua.' ,
651
+ ' Lorem ipsum dolor sit amet,\n consectetur adipiscing elit, sed do ' +
652
+ ' eiusmod \n tempor incididunt ut labore et dolore magna aliqua.' ,
654
653
' test' ,
655
654
' foo' ]], 4 ],
656
655
b: new Map ([[' za' , 1 ], [' zb' , ' test' ]])
@@ -660,13 +659,13 @@ console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 }));
660
659
// { a:
661
660
// [ 1,
662
661
// 2,
663
- // [ [ 'Lorem ipsum dolor sit amet, consectetur [...]', // A long line
662
+ // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line
664
663
// 'test',
665
664
// 'foo' ] ],
666
665
// 4 ],
667
666
// b: Map(2) { 'za' => 1, 'zb' => 'test' } }
668
667
669
- // Setting `compact` to false changes the output to be more reader friendly.
668
+ // Setting `compact` to false or an integer creates more reader friendly output .
670
669
console .log (util .inspect (o, { compact: false , depth: 5 , breakLength: 80 }));
671
670
672
671
// {
@@ -675,10 +674,9 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
675
674
// 2,
676
675
// [
677
676
// [
678
- // 'Lorem ipsum dolor sit amet, consectetur ' +
679
- // 'adipiscing elit, sed do eiusmod tempor ' +
680
- // 'incididunt ut labore et dolore magna ' +
681
- // 'aliqua.,
677
+ // 'Lorem ipsum dolor sit amet,\n' +
678
+ // 'consectetur adipiscing elit, sed do eiusmod \n' +
679
+ // 'tempor incididunt ut labore et dolore magna aliqua.',
682
680
// 'test',
683
681
// 'foo'
684
682
// ]
@@ -693,8 +691,6 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 }));
693
691
694
692
// Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a
695
693
// single line.
696
- // Reducing the `breakLength` will split the "Lorem ipsum" text in smaller
697
- // chunks.
698
694
```
699
695
700
696
The ` showHidden ` option allows [ ` WeakMap ` ] [ ] and [ ` WeakSet ` ] [ ] entries to be
0 commit comments