Splits up an array or string into chunks of the given size.

The array or string to split.

The chunk size.

  • Splits up a string into chunks of the given size.

    Parameters

    • str: string

      The string to split.

    • size: number

      The chunk size.

    Returns string[]

  • Splits up an array into chunks of the given size.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array to split.

    • size: number

      The chunk size.

    Returns T[][]