From 431cb7c034fb68f550507d9ed158165d658b2e63 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Fri, 4 Oct 2019 17:44:17 +0200 Subject: [PATCH] sortableSize helper function re-done to be a async function --- src/utils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils.js b/src/utils.js index 4650f07..53c581b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,9 +1,11 @@ -function sortableSize(string) { +const sortableSize = (string) => { const UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; const [numStr, unit] = string.split(' '); - if (UNITS.indexOf(unit) === -1) + + if (UNITS.indexOf(unit) === -1) return string - const exponent = UNITS.indexOf(unit) * 3 + + const exponent = UNITS.indexOf(unit) * 3 return numStr * (Math.pow(10, exponent)) }