dist/iterable/operators.js
/** Reduce the items in an iterable down to a single instance of initial type, yielding each step of the reduction */
Reduce the items in an iterable down to a single instance of initial type, yielding each step of the reduction
Reduce the items in an iterable down to a single instance of initial type yielding each step of the reduction
function scan(predicate, initial) {
    return function* (iterable) {
        let index = 0;
        let prevState = initial;
        for (const value of iterable) {
            prevState = predicate(prevState, value, index);
            yield prevState;
            index = index + 1;
        }
        return prevState;
    };
}
function scan ( predicate , initial ) { return function * ( iterable ) { let index = 0 ; let prevState = initial ; for ( const value of iterable ) { prevState = predicate ( prevState , value , index ) ; yield prevState ; index = index + 1 ; } return prevState ; } ; }
Reduce the items in an iterable down to a single instance of initial type, yielding each step of the reduction
Reduce the items in an iterable down to a single instance of initial type yielding each step of the reduction