Use Array.prototype.some instead of filter then length

This commit is contained in:
Nicolas Gotchac 2016-10-19 13:15:01 +02:00
parent 88eb72468e
commit 749e1e44b9

View File

@ -133,8 +133,7 @@ export default class List extends Component {
return searchValues
.map(searchValue => {
return values
.filter(value => value.indexOf(searchValue) >= 0)
.length > 0;
.some(value => value.indexOf(searchValue) >= 0);
})
// `current && truth, true` => use tokens as AND
// `current || truth, false` => use tokens as OR