🧩 Returns the nth item (0-indexed) from an iterable.
Syntax
TypeScript
import { nthIter } from '@opentf/std'; nthIter<T>(iter: Iterable<T>, n: number): T | undefined
Parameters
iter: The source iterable.n: The index of the item to return.
Returns
The nth item, or undefined.
Examples
TypeScript
nthIter([1, 2, 3], 1) //=> 2