Skip to content

Commit

Permalink
fix(table-sort): handle null and equal values
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjalmers committed Oct 22, 2024
1 parent 29f8809 commit e828e71
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions projects/core/src/lib/utilities/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ export const sortOnMultipleKeys = (
return (a, b) => {
for (let i = 0; i < keys.length; i++) {
const o = keys[i].key;
if (a[o] === b[o]) return 0;
if (a[o] === null) return 1;
if (b[o] === null) return -1;
if (a[o] > b[o]) return order[i];
if (a[o] < b[o]) return -order[i];
}
Expand Down

0 comments on commit e828e71

Please sign in to comment.