From 7a82b6547ef0c45a3582a921b5da759c47adbe3a Mon Sep 17 00:00:00 2001 From: David Larlet Date: Tue, 25 Jun 2024 18:14:34 -0400 Subject: [PATCH] chore: do not use Number.isNaN in special cases --- umap/static/umap/js/modules/facets.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/umap/static/umap/js/modules/facets.js b/umap/static/umap/js/modules/facets.js index 87bd9415..6677b5f6 100644 --- a/umap/static/umap/js/modules/facets.js +++ b/umap/static/umap/js/modules/facets.js @@ -36,16 +36,16 @@ export default class Facets { case 'datetime': case 'number': if (!Number.isNaN(value)) { - if ( - Number.isNaN(properties[name].min) || - properties[name].min > value - ) { + // Special cases where we want to be lousy when checking isNaN without + // coercing to a Number first because we handle multiple types. + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/ + // Reference/Global_Objects/Number/isNaN + // biome-ignore lint/suspicious/noGlobalIsNan: see above. + if (isNaN(properties[name].min) || properties[name].min > value) { properties[name].min = value } - if ( - Number.isNaN(properties[name].max) || - properties[name].max < value - ) { + // biome-ignore lint/suspicious/noGlobalIsNan: see above. + if (isNaN(properties[name].max) || properties[name].max < value) { properties[name].max = value } }