Skip to content

Commit

Permalink
fix: still sort when search value is absent
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Stevens committed Sep 14, 2020
1 parent cad3220 commit ecc38a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ const tests = {
'superduperfile',
],
},
'skip matching when no search value is absent': {
'sort when search value is absent': {
input: [
[
{tea: 'Milk', alias: 'moo'},
Expand All @@ -372,9 +372,9 @@ const tests = {
{keys: ['tea']},
],
output: [
{tea: 'Green', alias: 'C'},
{tea: 'Milk', alias: 'moo'},
{tea: 'Oolong', alias: 'B'},
{tea: 'Green', alias: 'C'},
],
},
'only match when key meets threshold': {
Expand Down
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const defaultBaseSortFn = (a, b) =>
* @return {Array} - the new sorted array
*/
function matchSorter(items, value, options = {}) {
// not performing any search/sort if value(search term) is empty
if (!value) return items

const {
keys,
threshold = rankings.MATCHES,
Expand Down

0 comments on commit ecc38a9

Please sign in to comment.