diff options
author | Weijia Wang <starkwang@126.com> | 2019-03-18 14:31:07 +0300 |
---|---|---|
committer | Weijia Wang <381152119@qq.com> | 2019-03-21 16:38:02 +0300 |
commit | c8d3a73c8b673792e315759b70cf4822b64b3e45 (patch) | |
tree | 39f35c7327e82964acf66f63c3e9d1c919c3382b /lib/internal/console | |
parent | 1935625df4f56bd77c57ec100a9222c77e9d440c (diff) |
lib: use Array#includes instead of Array#indexOf
PR-URL: https://github.com/nodejs/node/pull/26732
Refs: https://github.com/nodejs/node/issues/26568
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib/internal/console')
-rw-r--r-- | lib/internal/console/constructor.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 2fa812d9fe1..b9af931d385 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -220,7 +220,7 @@ Console.prototype[kWriteToConsole] = function(streamSymbol, string) { this._stdoutErrorHandler : this._stderrErrorHandler; if (groupIndent.length !== 0) { - if (string.indexOf('\n') !== -1) { + if (string.includes('\n')) { string = string.replace(/\n/g, `\n${groupIndent}`); } string = groupIndent + string; |