1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

fix(extensions/console): left align table entries (#11295)

This commit is contained in:
Divy Srivastava 2021-07-07 21:26:30 +05:30 committed by GitHub
parent e3a4e9cf11
commit a8dcf9e261
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 51 deletions

View file

@ -79,7 +79,6 @@
MapPrototypeForEach,
Error,
ErrorCaptureStackTrace,
MathCeil,
MathAbs,
MathMax,
MathMin,
@ -192,12 +191,8 @@
for (let i = 0; i < row.length; i++) {
const cell = row[i];
const len = getStringWidth(cell);
const needed = (columnWidths[i] - len) / 2;
// round(needed) + ceil(needed) will always add up to the amount
// of spaces we need while also left justifying the output.
out += `${StringPrototypeRepeat(" ", needed)}${cell}${
StringPrototypeRepeat(" ", MathCeil(needed))
}`;
const needed = columnWidths[i] - len;
out += `${cell}${StringPrototypeRepeat(" ", needed)}`;
if (i !== row.length - 1) {
out += tableChars.middle;
}