After sorting, empty strings are at the beginning of the sorted array
vladshcherbin opened this issue · 1 comments
vladshcherbin commented
const array = [
{ title: 'b' },
{ title: '' },
{ title: 'a' }
]
console.log(array.sort(sortBy('title')))
Output:
[
{ title: '' },
{ title: 'a' },
{ title: 'b' }
]
Expected output:
Since it's sorting by string, I'd expect empty strings to be last in the array:
[
{ title: 'a' },
{ title: 'b' },
{ title: '' }
]
crazy4groovy commented
assert('' < 'a')
right?