We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
match-sorter
node
npm
yarn
Relevant code or config
return value ? [].concat(value) : null
What you did: Use data which contains the number 0 as a property value as below:
const objList = [ {name: 'Janice', color: 'Green', rank:0}, {name: 'Fred', color: 'Orange', rank:100}, {name: 'George', color: 'Blue', rank:20}, {name: 'Jen', color: 'Red', rank:0}, ]
What happened:
The rows which have the numerical value zero are rejected falsely by the null check done while getting all items to compare.
Problem description:
matchSorter(objList, '0', {keys: ['name', 'rank']})
this returns:
[ {name: 'Fred', color: 'Orange', rank: 100 }, { name: 'George', color: 'Blue', rank: 20 } ]
but should return:
[ {name: 'Janice', color: 'Green', rank:0}, {name: 'Jen', color: 'Red', rank:0} {name: 'Fred', color: 'Orange', rank: 100 }, {name: 'George', color: 'Blue', rank: 20 } ]
Suggested solution:
Adding a check for the number zero in the return value of the function getItemValues.
return value || value === 0 ? [].concat(value) : null
The text was updated successfully, but these errors were encountered:
No branches or pull requests
match-sorter
version: 2.2.1node
version: 8.9.4npm
(oryarn
) version: 5.6.0Relevant code or config
What you did:
Use data which contains the number 0 as a property value as below:
What happened:
The rows which have the numerical value zero are rejected falsely by the null check done while getting all items to compare.
Problem description:
this returns:
but should return:
Suggested solution:
Adding a check for the number zero in the return value of the function getItemValues.
The text was updated successfully, but these errors were encountered: