Skip to content

Commit

Permalink
Remove bloat code (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caesarovich committed Aug 29, 2023
1 parent bbebe45 commit 74f1a0c
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions index.js
Expand Up @@ -181,26 +181,10 @@ const makeContentText = (text, {padding, width, textAlignment, height}) => {
const paddingLeft = PAD.repeat(padding.left);
const paddingRight = PAD.repeat(padding.right);

lines = lines.map(line => paddingLeft + line + paddingRight);

lines = lines.map(line => {
if (width - stringWidth(line) > 0) {
switch (textAlignment) {
case 'center': {
return line + PAD.repeat(width - stringWidth(line));
}

case 'right': {
return line + PAD.repeat(width - stringWidth(line));
}

default: {
return line + PAD.repeat(width - stringWidth(line));
}
}
}
const newLine = paddingLeft + line + paddingRight;

return line;
return newLine + PAD.repeat(width - stringWidth(newLine));
});

if (padding.top > 0) {
Expand Down

0 comments on commit 74f1a0c

Please sign in to comment.