dist/async-iterable/operators.js
/** Yield a new iterable sequence that applies the mapper to every item in the original */
Yield a new iterable sequence that applies the mapper to every item in the original
Yield a new iterable sequence that applies the mapper to every item in the original
function map(mapper) {
    return function (iterable) {
        return __asyncGenerator(this, arguments, function* () {
            var e_2, _a;
            let index = 0;
            try {
                for (var iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), !iterable_1_1.done;) {
                    const value = iterable_1_1.value;
                    yield yield __await(mapper(value, index));
                    index = index + 1;
                }
            }
            catch (e_2_1) { e_2 = { error: e_2_1 }; }
            finally {
                try {
                    if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) yield __await(_a.call(iterable_1));
                }
                finally { if (e_2) throw e_2.error; }
            }
        });
    };
}
function map ( mapper ) { return function ( iterable ) { return __asyncGenerator ( this , arguments , function * ( ) { var e_2 , _a ; let index = 0 ; try { for ( var iterable_1 = __asyncValues ( iterable ) , iterable_1_1 ; iterable_1_1 = yield __await ( iterable_1 . next ( ) ) , ! iterable_1_1 . done ; ) { const value = iterable_1_1 . value ; yield yield __await ( mapper ( value , index ) ) ; index = index + 1 ; } } catch ( e_2_1 ) { e_2 = { error : e_2_1 } ; } finally { try { if ( iterable_1_1 && ! iterable_1_1 . done && ( _a = iterable_1 . return ) ) yield __await ( _a . call ( iterable_1 ) ) ; } finally { if ( e_2 ) throw e_2 . error ; } } } ) ; } ; }
Yield a new iterable sequence that applies the mapper to every item in the original
Yield a new iterable sequence that applies the mapper to every item in the original