⚡ Skips the first N elements of an asynchronous iterable.
Syntax
import { dropIterAsync } from '@opentf/std';
dropIterAsync<T>(
iterable: AsyncIterable<T>,
n: number = 1
): AsyncGenerator<T>;Parameters
iterable: The source async iterable.n: The number of elements to skip. Default:1.
Returns
An AsyncGenerator that yields the remaining elements.
Examples
async function* gen() {
yield 1;
yield 2;
yield 3;
}
const iter = dropIterAsync(gen(), 2);
for await (const val of iter) {
console.log(val); //=> 3
}