repo.or.cz
/
ProtonMail-WebClient.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Use source loader for email sprite icons
[ProtonMail-WebClient.git]
/
packages
/
utils
/
percentage.ts
blob
62aee030fba15b85d2c4df1d28bb67c8c504988d
1
export default function percentage(entire: number, fraction: number) {
2
/*
3
* Safeguard against division by 0 error as well as
4
* NaN inputs for either "entire" or "fraction".
5
*/
6
if (!entire || !fraction) {
7
return 0;
8
}
9
10
return (fraction / entire) * 100;
11
}