UNPKG

@blakek/array-split

Version:

💔 Split and chunk arrays, strings, and more

13 lines (12 loc) • 529 B
interface Sliceable { length: number; slice: (start?: number | undefined, end?: number | undefined) => any; } export declare function chunk<T extends Sliceable>(chunkSize: number, array: T): T[]; export declare function splitAtIndex<T extends Sliceable>(index: number, array: T): T[]; export declare function splitAtIndices<T extends Sliceable>([index, nextIndex, ...indices]: number[], array: T): T[]; declare const _default: { chunk: typeof chunk; splitAtIndex: typeof splitAtIndex; }; export default _default;