Preparing search index...

    Function forEachChunk

    • Runs handler over items one chunk at a time, yielding to the event loop between chunks so long runs do not block the main thread.

      The handler is awaited for each chunk before moving on. No yield is emitted after the final chunk.

      Type Parameters

      • T

        Element type

      Parameters

      • items: readonly T[]

        Source array

      • handler: (chunk: T[], chunkIndex: number) => void | Promise<void>

        Called with each chunk and its zero-based index

      • chunkSize: number = DEFAULT_CHUNK_SIZE

        Maximum chunk length; must be a positive integer. Defaults to DEFAULT_CHUNK_SIZE

      Returns Promise<void>

      RangeError if chunkSize is not a positive integer