yta
    Preparing search index...

    Function at

    • Get the item at the given index, or undefined if the sequence is empty. Negative values count backwards from the end.

      import { pipe } from "yta";
      import { at, of } from "yta/async";

      await pipe(of("foo", "bar", "baz", "quux"), at(2));
      // => "baz"

      await pipe(of("foo", "bar", "baz", "quux"), at(-1));
      // => "quux"

      See also:

      Type Parameters

      • A

      Parameters

      • index: number

      Returns (items: AsyncIterable<A>) => Promise<A | undefined>