Accept iterable in chunk
This commit is contained in:
@@ -764,7 +764,7 @@ export const initArray = <T>(n: number, f: () => T) => {
|
|||||||
* @param xs - Array to split
|
* @param xs - Array to split
|
||||||
* @returns Array of chunks
|
* @returns Array of chunks
|
||||||
*/
|
*/
|
||||||
export const chunk = <T>(chunkLength: number, xs: T[]) => {
|
export const chunk = <T>(chunkLength: number, xs: Iterable<T>) => {
|
||||||
const result: T[][] = []
|
const result: T[][] = []
|
||||||
const current: T[] = []
|
const current: T[] = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user