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

+5-12
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
const elapsed = process.hrtime(startTime)[0];
218-
const mins = padString(Math.floor(elapsed / 60), 2, '0');
219-
const secs = padString(elapsed % 60, 2, '0');
220-
const passed = padString(successes, 6, ' ');
221-
const failed = padString(failures, 6, ' ');
218+
const mins = `${Math.floor(elapsed / 60)}`.padStart(2, '0');
219+
const secs = `${elapsed % 60}`.padStart(2, '0');
220+
const passed = `${successes}`.padStart(6);
221+
const failed = `${failures}`.padStart(6);
222222
var pct = Math.ceil(((totalPaths - paths.length) / totalPaths) * 100);
223-
pct = padString(pct, 3, ' ');
223+
pct = `${pct}`.padStart(3);
224224

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

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

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

0 commit comments

Comments
 (0)