Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

undo swapping isNaN => Number.isNaN since they eval differently which could cause issues

Jason Kentea02ea2b5111
diff --git a/web/js/components/date-selector/input.js b/web/js/components/date-selector/input.js
index caf96a0c9..bdaa0385b 100644
--- a/web/js/components/date-selector/input.js
+++ b/web/js/components/date-selector/input.js
@@ -125,7 +125,8 @@ class DateInputColumn extends Component {
case 'month':
newDate = this.monthValidation(value);
// transform month number to string (e.g., 3 -> 'MAR')
- if (newDate !== null && !Number.isNaN(value)) {
+ // eslint-disable-next-line no-restricted-globals
+ if (newDate !== null && !isNaN(value)) {
value = util.monthStringArray[value - 1];
}
break;
@@ -138,6 +139,8 @@ class DateInputColumn extends Component {
case 'minute':
newDate = this.minuteValidation(value);
break;
+ default:
+ break;
}
// add leading '0' to single string number
@@ -164,7 +167,7 @@ class DateInputColumn extends Component {
monthValidation = (input) => {
const date = new Date(this.props.date);
let newDate;
- if (!Number.isNaN(input) && input < 13 && input > 0) {
+ if (!isNaN(input) && input < 13 && input > 0) {
newDate = new Date(date.setUTCMonth(input - 1));
if (newDate) {
return this.validateDate(newDate);
@@ -263,7 +266,8 @@ class DateInputColumn extends Component {
? this.props.value
: inputValue;
- if (type === 'month' && !Number.isNaN(value)) {
+ // eslint-disable-next-line no-restricted-globals
+ if (type === 'month' && !isNaN(value)) {
value = util.monthStringArray[value - 1];
} else if (value.length === 1) {
value = `0${value}`;
diff --git a/web/js/edsc/geoutil.js b/web/js/edsc/geoutil.js
index 889486ffa..2495c7186 100644
--- a/web/js/edsc/geoutil.js
+++ b/web/js/edsc/geoutil.js
@@ -39,7 +39,7 @@ export default function (L, Coordinate, Arc, config) {
lat = RAD_TO_DEG * atan2(z, sqrt(x * x + y * y));
lon = RAD_TO_DEG * atan2(y, x);
// Guard against the points being the same or antipodal
- if (Number.isNaN(lat) || Number.isNaN(lon)) {
+ if (isNaN(lat) || isNaN(lon)) {
return p1;
}
while (lon < p1.lng - EPSILON) {
diff --git a/web/js/map/data/results.js b/web/js/map/data/results.js
index aa1dd69b6..6f28c993b 100644
--- a/web/js/map/data/results.js
+++ b/web/js/map/data/results.js
@@ -771,7 +771,8 @@ export function dataResultsTagVersionRegex(spec) {
if (version === null) {
console.warn('version not assigned', strVersion, granule);
- } else if (Number.isNaN(version)) {
+ // eslint-disable-next-line no-restricted-globals
+ } else if (isNaN(version)) {
console.warn('version is not a number', strVersion, granule);
} else {
granule.version = version;
diff --git a/web/js/map/map.js b/web/js/map/map.js
index ca30762e2..cfc611561 100644
--- a/web/js/map/map.js
+++ b/web/js/map/map.js
@@ -64,7 +64,8 @@ export function mapIsExtentValid(extent) {
extent = extent.toArray();
}
lodashEach(extent, (value) => {
- if (Number.isNaN(value)) {
+ // eslint-disable-next-line no-restricted-globals
+ if (isNaN(value)) {
valid = false;
return false;
}
diff --git a/web/js/map/model.js b/web/js/map/model.js
index 07dfd4614..0eb7b6e8a 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -94,7 +94,8 @@ export function mapModel(models, config) {
}
// get rotation if it exists
if (state.p === 'arctic' || state.p === 'antarctic') {
- if (!Number.isNaN(state.r)) {
+ // eslint-disable-next-line no-restricted-globals
+ if (!isNaN(state.r)) {
self.rotation = state.r * (Math.PI / 180.0);
} // convert to radians
}
diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.js
index 30d2b7831..ee8760ace 100644
--- a/web/js/modules/layers/util.js
+++ b/web/js/modules/layers/util.js
@@ -496,7 +496,8 @@ const createLayerArrayFromState = function(state, config) {
}
if (attr.id === 'opacity') {
opacity = util.clamp(parseFloat(attr.value), 0, 1);
- if (Number.isNaN(opacity)) opacity = 0; // "opacity=0.0" is opacity in URL, resulting in NaN
+ // eslint-disable-next-line no-restricted-globals
+ if (isNaN(opacity)) opacity = 0; // "opacity=0.0" is opacity in URL, resulting in NaN
}
if (attr.id === 'disabled') {
const values = util.toArray(attr.value.split(';'));
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index a9ce043b8..5e957a0cc 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -58,7 +58,8 @@ export function getMapParameterSetup(
initialState: 0,
options: {
serializeNeedsGlobalState: true,
- parse: (state) => (!Number.isNaN(state) ? state * (Math.PI / 180.0) : 0),
+ // eslint-disable-next-line no-restricted-globals
+ parse: (state) => (isNaN(state) ? state * (Math.PI / 180.0) : 0),
serialize: (currentItemState, currentState) => (currentItemState
&& currentState.proj.selected.id !== 'geographic'
? (currentItemState * (180.0 / Math.PI)).toPrecision(6)
@@ -87,7 +88,8 @@ export function mapIsExtentValid(extent) {
extent = extent.toArray();
}
lodashEach(extent, (value) => {
- if (Number.isNaN(value)) {
+ // eslint-disable-next-line no-restricted-globals
+ if (isNaN(value)) {
valid = false;
return false;
}
@@ -191,7 +193,8 @@ export function calculateExtent(extent, viewportExtent) {
// Current day (within map extent)
extent = getExtent(extent, viewportExtent);
}
- if (!Number.isFinite(extent[0])) {
+ // eslint-disable-next-line no-restricted-globals
+ if (!isFinite(extent[0])) {
return null;
}
return extent;
diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js
index a8f384d05..5a3efaffd 100644
--- a/web/js/modules/palettes/selectors.js
+++ b/web/js/modules/palettes/selectors.js
@@ -418,7 +418,8 @@ export function setDisabledSelector(
maps: {
[index]: {
$merge: {
- disabled: Number.isNaN(classIndex) ? [] : oldDisabled,
+ // eslint-disable-next-line no-restricted-globals
+ disabled: isNaN(classIndex) ? [] : oldDisabled,
},
},
},
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 291f7bd16..6f19edfc3 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -216,7 +216,8 @@ export default (function(self) {
}
const date = new Date(Date.UTC(year, month, day, hour, minute, second,
millisecond));
- if (Number.isNaN(date.getTime())) {
+ // eslint-disable-next-line no-restricted-globals
+ if (isNaN(date.getTime())) {
throw new Error(`Invalid date: ${dateAsString}`);
}
return date;
@@ -245,7 +246,8 @@ export default (function(self) {
* @param {Object} d | Date object
*/
self.isValidDate = function(d) {
- return d instanceof Date && !Number.isNaN(d);
+ // eslint-disable-next-line no-restricted-globals
+ return d instanceof Date && !isNaN(d);
};
/**
* Parses a UTC ISO 8601 date to a non UTC date
@@ -281,7 +283,8 @@ export default (function(self) {
}
const date = new Date(year, month, day, hour, minute, second,
millisecond);
- if (Number.isNaN(date.getTime())) {
+ // eslint-disable-next-line no-restricted-globals
+ if (isNaN(date.getTime())) {
throw new Error(`Invalid date: ${dateAsString}`);
}
return date;