From 1e46c0832608ac97c82b29c36bc28437dfea87ad Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 30 May 2017 17:03:00 +0300 Subject: [PATCH 1/3] doc: remove useless constructor in util.md --- doc/api/util.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index ba494263484812..261f6d764a6f86 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -196,9 +196,6 @@ ES6 example using `class` and `extends` const EventEmitter = require('events'); class MyStream extends EventEmitter { - constructor() { - super(); - } write(data) { this.emit('data', data); } From 73d5495a20f4d055cbd160e6f21ee7068d30fbbe Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 30 May 2017 17:04:52 +0300 Subject: [PATCH 2/3] doc: use template literals in util.md --- doc/api/util.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/util.md b/doc/api/util.md index 261f6d764a6f86..dc084def5c9202 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -326,8 +326,8 @@ class Box { // Five space padding because that's the size of "Box< ". const padding = ' '.repeat(5); const inner = util.inspect(this.value, newOptions) - .replace(/\n/g, '\n' + padding); - return options.stylize('Box', 'special') + '< ' + inner + ' >'; + .replace(/\n/g, `\n${padding}`); + return `${options.stylize('Box', 'special')}< ${inner} >`; } } From dd02ded91679251d37594b2c11e90d0989a7c55d Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 30 May 2017 17:05:46 +0300 Subject: [PATCH 3/3] doc: update code example in util.md Now all arrays with holes only are outputted the same way. In this example, it is `[ <101 empty items> ]` twice. --- doc/api/util.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index dc084def5c9202..77c02295ce3ee0 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -389,7 +389,7 @@ option properties directly is also supported. ```js const util = require('util'); -const arr = Array(101); +const arr = Array(101).fill(0); console.log(arr); // logs the truncated array util.inspect.defaultOptions.maxArrayLength = null;