dist/async-iterable/operators.js
function scan(predicate, initial) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_7, _a;
            let index = 0;
            let prevState = initial;
            try {
                for (var iterable_5 = __asyncValues(iterable), iterable_5_1; iterable_5_1 = yield __await(iterable_5.next()), !iterable_5_1.done;) {
                    const value = iterable_5_1.value;
                    prevState = yield __await(Promise.resolve(predicate(prevState, value, index)));
                    yield yield __await(prevState);
                    index = index + 1;
                }
            }
            catch (e_7_1) { e_7 = { error: e_7_1 }; }
            finally {
                try {
                    if (iterable_5_1 && !iterable_5_1.done && (_a = iterable_5.return)) yield __await(_a.call(iterable_5));
                }
                finally { if (e_7) throw e_7.error; }
            }
            return yield __await(prevState);
        });
    };
}
function scan(predicate, initial) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_7, _a;
            let index = 0;
            let prevState = initial;
            try {
                for (var iterable_5 = __asyncValues(iterable), iterable_5_1; iterable_5_1 = yield __await(iterable_5.next()), !iterable_5_1.done;) {
                    const value = iterable_5_1.value;
                    prevState = yield __await(Promise.resolve(predicate(prevState, value, index)));
                    yield yield __await(prevState);
                    index = index + 1;
                }
            }
            catch (e_7_1) { e_7 = { error: e_7_1 }; }
            finally {
                try {
                    if (iterable_5_1 && !iterable_5_1.done && (_a = iterable_5.return)) yield __await(_a.call(iterable_5));
                }
                finally { if (e_7) throw e_7.error; }
            }
            return yield __await(prevState);
        });
    };
}
function scan ( predicate , initial ) { return function ( iterable ) { return __asyncGenerator ( this , arguments , function * ( ) { var e_7 , _a ; let index = 0 ; let prevState = initial ; try { for ( var iterable_5 = __asyncValues ( iterable ) , iterable_5_1 ; iterable_5_1 = yield __await ( iterable_5 . next ( ) ) , ! iterable_5_1 . done ; ) { const value = iterable_5_1 . value ; prevState = yield __await ( Promise . resolve ( predicate ( prevState , value , index ) ) ) ; yield yield __await ( prevState ) ; index = index + 1 ; } } catch ( e_7_1 ) { e_7 = { error : e_7_1 } ; } finally { try { if ( iterable_5_1 && ! iterable_5_1 . done && ( _a = iterable_5 . return ) ) yield __await ( _a . call ( iterable_5 ) ) ; } finally { if ( e_7 ) throw e_7 . error ; } } return yield __await ( 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