Code coverage report for src/where.js

Statements: 100% (77 / 77)      Branches: 100% (40 / 40)      Functions: 100% (2 / 2)      Lines: 100% (6 / 6)      Ignored: 12 statements, 7 branches     

All files » src/ » where.js
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;