dist/async-iterable/operators.js
/** Enumerate until index and return the element at index, or consumes and return undefined */
Enumerate until index and return the element at index, or consumes and return undefined
Enumerate until index and return the element at index or consumes and return undefined
function elementAtOrDefault(index, or) {
    return async function (it) {
        var e_19, _a;
        let i = 0;
        try {
            for (var it_2 = __asyncValues(it), it_2_1; it_2_1 = await it_2.next(), !it_2_1.done;) {
                const item = it_2_1.value;
                if (i === index) {
                    return item;
                }
                i = i + 1;
            }
        }
        catch (e_19_1) { e_19 = { error: e_19_1 }; }
        finally {
            try {
                if (it_2_1 && !it_2_1.done && (_a = it_2.return)) await _a.call(it_2);
            }
            finally { if (e_19) throw e_19.error; }
        }
        return or;
    };
}
function elementAtOrDefault ( index , or ) { return async function ( it ) { var e_19 , _a ; let i = 0 ; try { for ( var it_2 = __asyncValues ( it ) , it_2_1 ; it_2_1 = await it_2 . next ( ) , ! it_2_1 . done ; ) { const item = it_2_1 . value ; if ( i === index ) { return item ; } i = i + 1 ; } } catch ( e_19_1 ) { e_19 = { error : e_19_1 } ; } finally { try { if ( it_2_1 && ! it_2_1 . done && ( _a = it_2 . return ) ) await _a . call ( it_2 ) ; } finally { if ( e_19 ) throw e_19 . error ; } } return or ; } ; }
Enumerate until index and return the element at index, or consumes and return undefined
Enumerate until index and return the element at index or consumes and return undefined