Skip to content

Commit

Permalink
fix: issue with NaN or Infinity in progress bar
Browse files Browse the repository at this point in the history
Just count it as 0, if done is NaN or Infinity.
  • Loading branch information
swashata committed Nov 13, 2018
1 parent 9940d8a commit 1b460a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/scripts/src/bin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ export function prettyPrintError(
}

export function getProgressBar(done: number): string {
if (isNaN(done) || done === Infinity || done === -Infinity) {
// tslint:disable-next-line:no-parameter-reassignment
done = 0;
}
const pbDoneLength = Math.floor((done / 100) * 20);

let gFunc = gradient('red', 'red');
Expand Down

0 comments on commit 1b460a1

Please sign in to comment.