From d1ded301a561333769df7d37523129f8453daf23 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Tue, 25 Jun 2024 21:41:29 -0400 Subject: [PATCH] chore: do not use Number.isNaN in special cases --- umap/static/umap/js/modules/rules.js | 3 ++- umap/static/umap/test/DataLayer.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/modules/rules.js b/umap/static/umap/js/modules/rules.js index fa802efb..dbeb88e0 100644 --- a/umap/static/umap/js/modules/rules.js +++ b/umap/static/umap/js/modules/rules.js @@ -74,7 +74,8 @@ class Rule { if (vars.length !== 2) return this.key = vars[0] this.expected = vars[1] - if (!Number.isNaN(this.expected)) this.cast = Number.parseFloat + // biome-ignore lint/suspicious/noGlobalIsNan: expected might not be a number. + if (!isNaN(this.expected)) this.cast = Number.parseFloat else if (['true', 'false'].includes(this.expected)) this.cast = (v) => !!v this.expected = this.cast(this.expected) } diff --git a/umap/static/umap/test/DataLayer.js b/umap/static/umap/test/DataLayer.js index 201f8a7f..26ba7d61 100644 --- a/umap/static/umap/test/DataLayer.js +++ b/umap/static/umap/test/DataLayer.js @@ -316,7 +316,7 @@ describe('U.DataLayer', () => { let icon = qs('div.umap-div-icon .icon_container') poly.properties.mycolor = 'DarkGoldenRod' marker.properties.mycolor = 'DarkRed' - delete marker.properties._umap_options.color + marker.properties._umap_options.color = undefined assert.notOk(qs('path[fill="DarkGoldenRod"]')) assert.equal(icon.style.backgroundColor, 'olivedrab') datalayer.options.color = '{mycolor}'