@szilanor/stream
    Preparing search index...

    Function buffer

    • Buffers the source elements into arrays of 'size' elements.

      Type Parameters

      • T

        Type of the elements.

      Parameters

      • size: number

        The number of elements in each buffer.

      Returns OperationFunction<T, T[]>

      Operation that buffers the source elements.

      const result = buffer(3)([1, 2, 3, 4, 5, 6]);
      console.log([...result]); // [[1, 2, 3], [4, 5, 6]]