typedash
Version:
modern, type-safe collection of utility functions
21 lines (20 loc) • 645 B
TypeScript
import { t as Maybe } from "./Maybe-pvX1mStM.js";
//#region src/functions/chunk/chunk.d.ts
/**
* Splits an array into chunks of the given size.
* @param array The array to split.
* @param size The maximum size of each chunk.
* @returns An array of arrays where each sub-array has at most `size` elements.
* @example
* ```ts
* chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
* ```
*/
declare function chunk<T>(array: Maybe<readonly T[]>, size: number): T[][];
/**
* Alias for {@link chunk}.
*/
declare const chunkArray: typeof chunk;
//#endregion
export { chunkArray as n, chunk as t };
//# sourceMappingURL=chunk-Bkhg577U.d.ts.map