mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-02-08 18:48:18 +01:00
Return empty string
This commit is contained in:
parent
64a9892ee2
commit
ea2842f37f
@ -15,7 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export function formatSize(size: number, decimals: number = 2): string | undefined {
|
||||
export function formatSize(size: number, decimals: number = 2): string {
|
||||
if (Number.isSafeInteger(size)) {
|
||||
const base = Math.min(3, Math.floor(Math.log(size) / Math.log(1024)));
|
||||
const formattedSize = Math.round(size / Math.pow(1024, base)).toFixed(decimals);
|
||||
@ -26,4 +26,5 @@ export function formatSize(size: number, decimals: number = 2): string | undefin
|
||||
case 3: return `${formattedSize} GB`;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user