mirror of
https://github.com/Lissy93/awesome-privacy.git
synced 2026-03-11 08:55:33 +00:00
Adds type check for putCommaInNumber
This commit is contained in:
parent
d0d3c2aa38
commit
bedd34c379
1 changed files with 4 additions and 1 deletions
|
|
@ -18,7 +18,10 @@ const makeRatingPercentage = (rating: number) => (rating / 5) * 100;
|
|||
|
||||
const roundRatings = (rating: number) => Math.round(rating * 100) / 100;
|
||||
|
||||
const putCommaInNumber = (num: number) => num.toLocaleString();
|
||||
const putCommaInNumber = (num: number | any) => {
|
||||
if (!num) return 'Unknown';
|
||||
return typeof num === 'number' ? num.toLocaleString() : num;
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue