sortableSize helper function re-done to be a async function
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
function sortableSize(string) {
|
const sortableSize = (string) => {
|
||||||
const UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
const UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||||
const [numStr, unit] = string.split(' ');
|
const [numStr, unit] = string.split(' ');
|
||||||
if (UNITS.indexOf(unit) === -1)
|
|
||||||
|
if (UNITS.indexOf(unit) === -1)
|
||||||
return string
|
return string
|
||||||
const exponent = UNITS.indexOf(unit) * 3
|
|
||||||
|
const exponent = UNITS.indexOf(unit) * 3
|
||||||
return numStr * (Math.pow(10, exponent))
|
return numStr * (Math.pow(10, exponent))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user