mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
chore: do not use Number.isNaN in special cases
This commit is contained in:
parent
c61ca9c506
commit
d1ded301a5
2 changed files with 3 additions and 2 deletions
|
@ -74,7 +74,8 @@ class Rule {
|
||||||
if (vars.length !== 2) return
|
if (vars.length !== 2) return
|
||||||
this.key = vars[0]
|
this.key = vars[0]
|
||||||
this.expected = vars[1]
|
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
|
else if (['true', 'false'].includes(this.expected)) this.cast = (v) => !!v
|
||||||
this.expected = this.cast(this.expected)
|
this.expected = this.cast(this.expected)
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ describe('U.DataLayer', () => {
|
||||||
let icon = qs('div.umap-div-icon .icon_container')
|
let icon = qs('div.umap-div-icon .icon_container')
|
||||||
poly.properties.mycolor = 'DarkGoldenRod'
|
poly.properties.mycolor = 'DarkGoldenRod'
|
||||||
marker.properties.mycolor = 'DarkRed'
|
marker.properties.mycolor = 'DarkRed'
|
||||||
delete marker.properties._umap_options.color
|
marker.properties._umap_options.color = undefined
|
||||||
assert.notOk(qs('path[fill="DarkGoldenRod"]'))
|
assert.notOk(qs('path[fill="DarkGoldenRod"]'))
|
||||||
assert.equal(icon.style.backgroundColor, 'olivedrab')
|
assert.equal(icon.style.backgroundColor, 'olivedrab')
|
||||||
datalayer.options.color = '{mycolor}'
|
datalayer.options.color = '{mycolor}'
|
||||||
|
|
Loading…
Reference in a new issue