Add filter and find by account function to contributors #42

Merged
bumi merged 3 commits from feature/filter-contributors-by-account into master 2018-04-26 14:27:26 +00:00
Showing only changes of commit 017073018f - Show all commits

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;
});
});
});
});