| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 5 17 17 17 9 | function *where(xs, query) {
let props = Object.getOwnPropertyNames(query);
for (let x of xs) {
let match = true;
for (let prop of props) {
if (query[prop] !== x[prop]) {
match = false;
break;
}
}
if (match) {
yield x;
}
}
}
export default where;
|