Skip to content

Commit 46ec26f

Browse 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

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎lib/internal/util/inspect.js‎

Lines 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-
constminLineLength=Math.max(ctx.breakLength-ctx.indentationLvl,kMinLineLength);
827-
// eslint-disable-next-line max-len
828-
constaverageLineLength=Math.ceil(value.length/Math.ceil(value.length/minLineLength));
825+
constrawMaxLineLength=ctx.breakLength-ctx.indentationLvl;
826+
constmaxLineLength=Math.max(rawMaxLineLength,kMinLineLength);
827+
constlines=Math.ceil(value.length/maxLineLength);
828+
constaverageLineLength=Math.ceil(value.length/lines);
829829
constdivisor=Math.max(averageLineLength,kMinLineLength);
830-
letres='';
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
constmatches=value.match(readableRegExps[divisor]);
844843
if(matches.length>1){
845844
constindent=' '.repeat(ctx.indentationLvl);
846-
res+=`${fn(strEscape(matches[0]),'string')} +\n`;
845+
letres=`${fn(strEscape(matches[0]),'string')} +\n`;
847846
for(vari=1;i<matches.length-1;i++){
848847
res+=`${indent}${fn(strEscape(matches[i]),'string')} +\n`;
849848
}

0 commit comments

Comments
 (0)