File size: 357 Bytes
48e0731 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
export function parseFileSize(size) {
const sized = parseFloat(size);
return (isNaN(sized) ? 0 : sized) * (
/GB/i.test(size)
? 1000000
: /MB/i.test(size)
? 1000
: /KB/i.test(size)
? 1
: /bytes?/i.test(size)
? 0.001
: /B/i.test(size)
? 0.1
: 0
);
} |