This function splits a string into chunks of specified size.
If the string length is not a multiple of the chunk size,
the last chunk will contain the remaining characters.
Parameters
text: string
The string to be split into chunks.
chunkSize: number
The size of each chunk. Must be a positive integer.
Returns string[]
An array of strings, each representing a chunk of the original string.
Throws
RangeError if the chunk size is not a positive integer.
This function splits a string into chunks of specified size. If the string length is not a multiple of the chunk size, the last chunk will contain the remaining characters.