dist/iterable/operators.js
/** Reduce the items in an iterable down to a single instance of the same type as the type contained by that Iterable */
Reduce the items in an iterable down to a single instance of the same type as the type contained by that Iterable
Reduce the items in an iterable down to a single instance of the same type as the type contained by that Iterable
function fold(predicate) {
    return function (iterable) {
        let index = 0;
        let prevState;
        for (const value of iterable) {
            if (index === 0) {
                prevState = value;
            }
            else {
                prevState = predicate(prevState, value, index);
            }
            index = index + 1;
        }
        return prevState;
    };
}
function fold ( predicate ) { return function ( iterable ) { let index = 0 ; let prevState ; for ( const value of iterable ) { if ( index === 0 ) { prevState = value ; } else { prevState = predicate ( prevState , value , index ) ; } index = index + 1 ; } return prevState ; } ; }
Reduce the items in an iterable down to a single instance of the same type as the type contained by that Iterable
Reduce the items in an iterable down to a single instance of the same type as the type contained by that Iterable