Skip to content

Commit

Permalink
Fix number filter for comparison with zero (#787)
Browse files Browse the repository at this point in the history
Co-authored-by: st4ng <[email protected]>
  • Loading branch information
st4ng and st4ng authored Feb 12, 2024
1 parent 0f8c05d commit 86ba1dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ui/app/filterFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type DataRecord,
type DataValue,
type Optional,
isNumber,
isOptionalString,
isOptionalNumber,
isOptionalBoolean,
Expand Down Expand Up @@ -113,10 +114,10 @@ export const numberFns: Record<
> = {
eq: (left, right) => left === right,
neq: (left, right) => left !== right,
lt: (left, right) => (left && right ? left < right : false),
gt: (left, right) => (left && right ? left > right : false),
lte: (left, right) => (left && right ? left <= right : false),
gte: (left, right) => (left && right ? left >= right : false),
lt: (left, right) => isNumber(left) && isNumber(right) && left < right,
gt: (left, right) => isNumber(left) && isNumber(right) && left > right,
lte: (left, right) => isNumber(left) && isNumber(right) && left <= right,
gte: (left, right) => isNumber(left) && isNumber(right) && left >= right,
};

export const booleanFns: Record<
Expand Down

0 comments on commit 86ba1dd

Please sign in to comment.