Code coverage report for src/compact.js

Statements: 100% (41 / 41)      Branches: 100% (21 / 21)      Functions: 100% (2 / 2)      Lines: 100% (2 / 2)      Ignored: 6 statements, 4 branches     

All files » src/ » compact.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15            24                
/**
 * Yields the truthy values from the iterable.
 * @param {*} xs - The iterable to compact.
 * @returns {*} - All truthy values from the iterable.
 */
function *compact(xs) {
    for (let x of xs) {
        if (x) {
            yield x;
        }
    }
}
 
export default compact;