chore: do not use Number.isNaN in special cases

This commit is contained in:
David Larlet 2024-06-25 21:41:29 -04:00
parent c61ca9c506
commit d1ded301a5
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
2 changed files with 3 additions and 2 deletions

View file

@ -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)
}

View file

@ -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}'