Use more readable Array.every method instead of reduce

This commit is contained in:
bumi 2018-04-26 15:35:32 +02:00
parent fe1fa2e881
commit 017073018f

View File

@ -49,9 +49,10 @@ class Contributor extends Base {
return contributors[method]((contributor) => {
if (!contributor.accounts) { return false; }
return contributor.accounts.find((account) => {
return searchEntries.reduce((accumulator, searchValue) => {
return accumulator && account[searchValue[0]] === searchValue[1];
}, true);
return searchEntries.every((item) => {
let [ key, value ] = item;
return account[key] === value;
});
});
});
});