Code coverage report for src/flatten.js

Statements: 100% (84 / 84)      Branches: 100% (51 / 51)      Functions: 100% (3 / 3)      Lines: 100% (3 / 3)      Ignored: 12 statements, 9 branches     

All files » src/ » flatten.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21              17   32                      
import flattenDeep from './flattenDeep';
 
 
function *flatten(xs, deep=false) {
    if (deep) {
        yield *flattenDeep(xs);
    } else {
        for (let x of xs) {
            if (x && x[Symbol.iterator]) {
                for (let y of x) {
                    yield y;
                }
            } else {
                yield x;
            }
        }
    }
}
 
export default flatten;