Skip to content

Commit

Permalink
Simplify decoration logic by using padEnd function
Browse files Browse the repository at this point in the history
  • Loading branch information
frankgrimes97 committed Aug 30, 2024
1 parent 34440ae commit ef25610
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,9 @@ async function run(): Promise<void> {
}
}
if (vulnidColorized.length > 0 && vulnsevColorized.length > 0) {
const pkgTextPadding = Math.max(40 - v.PkgName.length, 0);
const pkgTxt = `${chalk.magenta(v.PkgName)}${new Array(pkgTextPadding).join(' ')}`;
const vulnidTxtPadding = Math.max(40 - v.VulnerabilityID.length, 0);
const vulnidTxt = `${vulnidColorized}${new Array(vulnidTxtPadding).join(' ')}`;
const vulnsevTxtPadding = Math.max(30 - v.Severity.length, 0);
const pkgTxt = `${chalk.magenta(v.PkgName).padEnd(40)}`;
const vulnidTxt = `${vulnidColorized.padEnd(40)}`;
const vulnsevTxt = `${vulnsevColorized.padEnd(30)}`;
res.unhealthyMsg = `${pkgTxt} ${vulnidTxt} ${vulnsevTxt} ${v.Title}`;
isUnhealthy = true;
}
Expand Down

0 comments on commit ef25610

Please sign in to comment.