yta
    Preparing search index...

    Function enumerate

    • Map the iterator into enumerated pairs.

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

      pipe(of("a", "b", "c"), enumerate(), toArray());
      // => [[0, "a"], [1, "b"], [2, "c"]]

      Type Parameters

      • A

        The item type

      Returns (items: AsyncIterable<A>) => AsyncGenerator<[number, A], void>