Skip to content

Commit

Permalink
fix: revert better alphanumeric sort of bools and floats (fix #5108) (#…
Browse files Browse the repository at this point in the history
…5109) (#5129)

This reverts commit 3f9d382.
  • Loading branch information
KevinVandy authored Oct 13, 2023
1 parent e4ddee6 commit 02a7884
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 90 deletions.
80 changes: 0 additions & 80 deletions packages/table-core/__tests__/Sorting.test.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/table-core/src/sortingFns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ function compareBasic(a: any, b: any) {
}

function toString(a: any) {
if (typeof a === 'boolean') {
return String(a)
}
if (typeof a === 'number') {
if (isNaN(a) || a === Infinity || a === -Infinity) {
return ''
Expand All @@ -74,13 +71,6 @@ function toString(a: any) {
// It handles numbers, mixed alphanumeric combinations, and even
// null, undefined, and Infinity
function compareAlphanumeric(aStr: string, bStr: string) {
// Check if the string contains only a number
const aFloat = parseFloat(aStr);
const bFloat = parseFloat(bStr);
if(!isNaN(aFloat) && !isNaN(bFloat)) {
return compareBasic(aFloat, bFloat)
}

// Split on number groups, but keep the delimiter
// Then remove falsey split values
const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)
Expand Down

0 comments on commit 02a7884

Please sign in to comment.