Skip to content

Commit

Permalink
Use localCompare for att-based element filtering
Browse files Browse the repository at this point in the history
Co-authored-by: Jack Wilburn <[email protected]>
  • Loading branch information
NateLanza and JackWilb authored Oct 23, 2024
1 parent ab6dc6d commit 166a000
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export function filterItems(items: Item[], filter: ElementSelection): Item[] {
case ElementQueryType.REGEX:
return (new RegExp(query).test(`${item[att]}`));
case ElementQueryType.GREATER_THAN:
return item[att] > (typeof item[att] === 'number' ? Number(query) : query);
return `${item[att]}`.localeCompare(query, undefined, { numeric: typeof item[att] === 'number' }) > 0;
case ElementQueryType.LESS_THAN:
return item[att] < (typeof item[att] === 'number' ? Number(query) : query);
return `${item[att]}`.localeCompare(query, undefined, { numeric: typeof item[att] === 'number' }) < 0;
default:
}
return false;
Expand Down

0 comments on commit 166a000

Please sign in to comment.