kvnneff/sort-by

After sorting, empty strings are at the beginning of the sorted array

vladshcherbin opened this issue · 1 comments

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: '' }
]

assert('' < 'a') right?