chore: do not use Number.isNaN in special cases

This commit is contained in:
David Larlet 2024-06-25 18:14:34 -04:00
parent 5c88502a2e
commit 7a82b6547e
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD

View file

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