fast-sort
fast-sort copied to clipboard
Fix sorting of array with multiple types
fixes https://github.com/snovakovic/fast-sort/issues/62
Running of benchmark and there is no noticeable effect on performance
There is still some know issues with this update as e.g
sort([1, 3, 2, '1a', 'a', '2', '5', 6]).asc() // === [1,2,"2",3,"1a","5",6,"a"]
But currently trying to find balance between know issue and performance... It's easy to fix above but that require more check which have negative performance impact on every sort just for some edge cases. (&& we can always use naturalSort or any custom sort)
@snovakovic how about providing a separate sort function that can be imported just for the case of arrays with multiple types.
I agree we shouldn't cause any degredation in the existing performance.
You could call it import { sortMultiTypeArray } from 'fast-sort'
or something
and tree-shaking will make it so no one will have negative impact.
@mesqueeb on second look manage to solve above issue without performance penalties so there is no need for separate function