Skip to content

Commit c4eb683

Browse files
tniessenMylesBorins
authored andcommitted
tools: use built-in padStart instead of padString
PR-URL: #17120 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a9be7bf commit c4eb683

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

‎tools/lint-js.js‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ if (cluster.isMaster){
215215

216216
// Calculate and format the data for displaying
217217
constelapsed=process.hrtime(startTime)[0];
218-
constmins=padString(Math.floor(elapsed/60),2,'0');
219-
constsecs=padString(elapsed%60,2,'0');
220-
constpassed=padString(successes,6,' ');
221-
constfailed=padString(failures,6,' ');
218+
constmins=`${Math.floor(elapsed/60)}`.padStart(2,'0');
219+
constsecs=`${elapsed%60}`.padStart(2,'0');
220+
constpassed=`${successes}`.padStart(6);
221+
constfailed=`${failures}`.padStart(6);
222222
varpct=Math.ceil(((totalPaths-paths.length)/totalPaths)*100);
223-
pct=padString(pct,3,' ');
223+
pct=`${pct}`.padStart(3);
224224

225225
varline=`[${mins}:${secs}|%${pct}|+${passed}|-${failed}]: ${curPath}`;
226226

@@ -233,13 +233,6 @@ if (cluster.isMaster){
233233

234234
outFn(line);
235235
}
236-
237-
functionpadString(str,len,chr){
238-
str=`${str}`;
239-
if(str.length>=len)
240-
returnstr;
241-
returnchr.repeat(len-str.length)+str;
242-
}
243236
}else{
244237
// Worker
245238

0 commit comments

Comments
(0)