Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46ec26f

Browse filesBrowse files
BridgeARaddaleax
authored andcommitted
util: remove eslint comments and rename variables
This should improve the readability of the code. PR-URL: #25255 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7ff4410 commit 46ec26f
Copy full SHA for 46ec26f

File tree

Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed
Open diff view settings
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -822,12 +822,11 @@ function formatPrimitive(fn, value, ctx) {
822822
if (ctx.compact === false &&
823823
ctx.indentationLvl + value.length > ctx.breakLength &&
824824
value.length > kMinLineLength) {
825-
// eslint-disable-next-line max-len
826-
const minLineLength = Math.max(ctx.breakLength - ctx.indentationLvl, kMinLineLength);
827-
// eslint-disable-next-line max-len
828-
const averageLineLength = Math.ceil(value.length / Math.ceil(value.length / minLineLength));
825+
const rawMaxLineLength = ctx.breakLength - ctx.indentationLvl;
826+
const maxLineLength = Math.max(rawMaxLineLength, kMinLineLength);
827+
const lines = Math.ceil(value.length / maxLineLength);
828+
const averageLineLength = Math.ceil(value.length / lines);
829829
const divisor = Math.max(averageLineLength, kMinLineLength);
830-
let res = '';
831830
if (readableRegExps[divisor] === undefined) {
832831
// Build a new RegExp that naturally breaks text into multiple lines.
833832
//
@@ -843,7 +842,7 @@ function formatPrimitive(fn, value, ctx) {
843842
const matches = value.match(readableRegExps[divisor]);
844843
if (matches.length > 1) {
845844
const indent = ' '.repeat(ctx.indentationLvl);
846-
res += `${fn(strEscape(matches[0]), 'string')} +\n`;
845+
let res = `${fn(strEscape(matches[0]), 'string')} +\n`;
847846
for (var i = 1; i < matches.length - 1; i++) {
848847
res += `${indent} ${fn(strEscape(matches[i]), 'string')} +\n`;
849848
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.