From fca982c609571876a87ca3ccd8627dc4bc6c8726 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Wed, 26 Jul 2017 09:22:03 -0700 Subject: [PATCH] [bugfix] fix bar order (#3180) --- superset/assets/javascripts/modules/utils.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/superset/assets/javascripts/modules/utils.js b/superset/assets/javascripts/modules/utils.js index 7349dbb7f8..61949c7e2b 100644 --- a/superset/assets/javascripts/modules/utils.js +++ b/superset/assets/javascripts/modules/utils.js @@ -229,14 +229,10 @@ export function initJQueryAjax() { } export function tryNumify(s) { - // Attempts casting to float, returns string when failing - try { - const parsed = parseFloat(s); - if (parsed) { - return parsed; - } - } catch (e) { - // pass + // Attempts casting to Number, returns string when failing + const n = Number(s); + if (isNaN(n)) { + return s; } - return s; + return n; }