summaryrefslogtreecommitdiff
path: root/lib/internal
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-12-28 02:42:27 +0100
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-01-11 07:32:31 +0100
commit6cc74b038fa0d2e64e8060415487706117b4a77c (patch)
tree167b8423b5c3502c13643548e64bf857bfb6e525 /lib/internal
parent1bee544a20633370d33a592d54ab44f2e6653e69 (diff)
downloadandroid-node-v8-6cc74b038fa0d2e64e8060415487706117b4a77c.tar.gz
android-node-v8-6cc74b038fa0d2e64e8060415487706117b4a77c.tar.bz2
android-node-v8-6cc74b038fa0d2e64e8060415487706117b4a77c.zip
util: remove eslint comments and rename variables
This should improve the readability of the code. PR-URL: https://github.com/nodejs/node/pull/25255 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal')
-rw-r--r--lib/internal/util/inspect.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index e5cde4d335..88362f8615 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -822,12 +822,11 @@ function formatPrimitive(fn, value, ctx) {
if (ctx.compact === false &&
ctx.indentationLvl + value.length > ctx.breakLength &&
value.length > kMinLineLength) {
- // eslint-disable-next-line max-len
- const minLineLength = Math.max(ctx.breakLength - ctx.indentationLvl, kMinLineLength);
- // eslint-disable-next-line max-len
- const averageLineLength = Math.ceil(value.length / Math.ceil(value.length / minLineLength));
+ const rawMaxLineLength = ctx.breakLength - ctx.indentationLvl;
+ const maxLineLength = Math.max(rawMaxLineLength, kMinLineLength);
+ const lines = Math.ceil(value.length / maxLineLength);
+ const averageLineLength = Math.ceil(value.length / lines);
const divisor = Math.max(averageLineLength, kMinLineLength);
- let res = '';
if (readableRegExps[divisor] === undefined) {
// Build a new RegExp that naturally breaks text into multiple lines.
//
@@ -843,7 +842,7 @@ function formatPrimitive(fn, value, ctx) {
const matches = value.match(readableRegExps[divisor]);
if (matches.length > 1) {
const indent = ' '.repeat(ctx.indentationLvl);
- res += `${fn(strEscape(matches[0]), 'string')} +\n`;
+ let res = `${fn(strEscape(matches[0]), 'string')} +\n`;
for (var i = 1; i < matches.length - 1; i++) {
res += `${indent} ${fn(strEscape(matches[i]), 'string')} +\n`;
}