dist/async-iterable/operators.js
function reduce(predicate, initial) {
    return async function (iterable) {
        var e_6, _a;
        let index = 0;
        let prevState = initial;
        try {
            for (var iterable_4 = __asyncValues(iterable), iterable_4_1; iterable_4_1 = await iterable_4.next(), !iterable_4_1.done;) {
                const value = iterable_4_1.value;
                prevState = await predicate(prevState, value, index);
                index = index + 1;
            }
        }
        catch (e_6_1) { e_6 = { error: e_6_1 }; }
        finally {
            try {
                if (iterable_4_1 && !iterable_4_1.done && (_a = iterable_4.return)) await _a.call(iterable_4);
            }
            finally { if (e_6) throw e_6.error; }
        }
        return prevState;
    };
}
function reduce(predicate, initial) {
    return async function (iterable) {
        var e_6, _a;
        let index = 0;
        let prevState = initial;
        try {
            for (var iterable_4 = __asyncValues(iterable), iterable_4_1; iterable_4_1 = await iterable_4.next(), !iterable_4_1.done;) {
                const value = iterable_4_1.value;
                prevState = await predicate(prevState, value, index);
                index = index + 1;
            }
        }
        catch (e_6_1) { e_6 = { error: e_6_1 }; }
        finally {
            try {
                if (iterable_4_1 && !iterable_4_1.done && (_a = iterable_4.return)) await _a.call(iterable_4);
            }
            finally { if (e_6) throw e_6.error; }
        }
        return prevState;
    };
}
function reduce ( predicate , initial ) { return async function ( iterable ) { var e_6 , _a ; let index = 0 ; let prevState = initial ; try { for ( var iterable_4 = __asyncValues ( iterable ) , iterable_4_1 ; iterable_4_1 = await iterable_4 . next ( ) , ! iterable_4_1 . done ; ) { const value = iterable_4_1 . value ; prevState = await predicate ( prevState , value , index ) ; index = index + 1 ; } } catch ( e_6_1 ) { e_6 = { error : e_6_1 } ; } finally { try { if ( iterable_4_1 && ! iterable_4_1 . done && ( _a = iterable_4 . return ) ) await _a . call ( iterable_4 ) ; } finally { if ( e_6 ) throw e_6 . error ; } } return prevState ; } ; }
Reduce the items in an iterable down to a single instance of initial type, returning the final result result of the reduction
Reduce the items in an iterable down to a single instance of initial type returning the final result result of the reduction