This is an automated email from the ASF dual-hosted git repository.

ccwilliams pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0aa6d90  Remove isNumeric util function and use Number.isFinite 
instead (#6106)
0aa6d90 is described below

commit 0aa6d90429bd940d10bb489efa15a71a91dcfb52
Author: Krist Wongsuphasawat <krist.wo...@gmail.com>
AuthorDate: Thu Oct 18 11:24:43 2018 -0700

    Remove isNumeric util function and use Number.isFinite instead (#6106)
    
    * remove isNumeric util function and use lodash isFinite instead
    
    * use native Number.isFinite
---
 superset/assets/src/utils/common.js                                | 4 ----
 .../assets/src/visualizations/MapBox/ScatterPlotGlowOverlay.jsx    | 7 ++++---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/superset/assets/src/utils/common.js 
b/superset/assets/src/utils/common.js
index 7fa7043..4da740e 100644
--- a/superset/assets/src/utils/common.js
+++ b/superset/assets/src/utils/common.js
@@ -21,10 +21,6 @@ export function kmToPixels(kilometers, latitude, zoomLevel) {
   return d3.round(kilometers / kmPerPixel, 2);
 }
 
-export function isNumeric(num) {
-  return !isNaN(parseFloat(num)) && isFinite(num);
-}
-
 export function rgbLuminance(r, g, b) {
   // Formula: https://en.wikipedia.org/wiki/Relative_luminance
   return LUMINANCE_RED_WEIGHT * r + LUMINANCE_GREEN_WEIGHT * g + 
LUMINANCE_BLUE_WEIGHT * b;
diff --git 
a/superset/assets/src/visualizations/MapBox/ScatterPlotGlowOverlay.jsx 
b/superset/assets/src/visualizations/MapBox/ScatterPlotGlowOverlay.jsx
index 40c5861..e67302a 100644
--- a/superset/assets/src/visualizations/MapBox/ScatterPlotGlowOverlay.jsx
+++ b/superset/assets/src/visualizations/MapBox/ScatterPlotGlowOverlay.jsx
@@ -6,7 +6,6 @@ import ViewportMercator from 'viewport-mercator-project';
 import {
   kmToPixels,
   rgbLuminance,
-  isNumeric,
   MILES_PER_KM,
 } from '../../utils/common';
 
@@ -154,7 +153,7 @@ class ScatterPlotGlowOverlay extends React.Component {
             ctx.fillStyle = gradient;
             ctx.fill();
 
-            if (isNumeric(clusterLabel)) {
+            if (Number.isFinite(parseFloat(clusterLabel))) {
               if (clusterLabel >= 10000) {
                 clusterLabel = Math.round(clusterLabel / 1000) + 'k';
               } else if (clusterLabel >= 1000) {
@@ -187,7 +186,9 @@ class ScatterPlotGlowOverlay extends React.Component {
             }
 
             if (pointMetric !== null) {
-              pointLabel = isNumeric(pointMetric) ? d3.round(pointMetric, 2) : 
pointMetric;
+              pointLabel = Number.isFinite(parseFloat(pointMetric))
+                ? d3.round(pointMetric, 2)
+                : pointMetric;
             }
 
             // Fall back to default points if pointRadius wasn't a numerical 
column

Reply via email to