Skip to content

Commit

Permalink
fix(format-bytes): handle bytes variable undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
ElonH committed May 31, 2020
1 parent 7a3713f commit 1b227a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/utils/format-bytes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License: MIT
*/
export function FormatBytes(bytes: number, decimals = 2) {
if (bytes < 0) return '-';
if (bytes < 0 || typeof bytes !== 'number') return '-';
if (bytes === 0) return '0 B';

const k = 1024;
Expand Down

0 comments on commit 1b227a9

Please sign in to comment.