Closed RebeccaStevens closed 4 years ago
Thanks for the issue Rebecca. I agree with you. Would you be willing to make a pull request to add this functionality (and fix the README too)?
Made the PR :)
:tada: This issue has been resolved in version 4.2.1 :tada:
The release is available on:
npm package (@latest dist-tag)
Your semantic-release bot :package::rocket:
match-sorter
version: 4.2.0node
version: 14.8.0npm
(oryarn
) version: 6.14.7 (or 1.21.1 :stuck_out_tongue:)Relevant code or config
What you did:
What happened:
The list was returned unsorted.
Problem description:
As no search string was supplied, all items should have the same ranking, therefore the base sort should be applied as the tie-breaker. i.e. The list should be sorted but it's not.
Suggested solution:
If the search string is empty, apply the base sort instead of just returning the list unsorted.
Additional Note:
I stole the "Relevant code" from the Usage section of the Read Me. When I did, I noticed that it's slightly out of date now as the base sort is not be applied to the output.
matchSorter(list, 'h') // ['hi', 'hey', 'hello']
should bematchSorter(list, 'h') // [ 'hello', 'hey', 'hi' ]