Skip to content

chunk

chunk<T>(items, size): T[][]

Defined in: packages/simply-core/src/collection/chunk.ts:31

Split an array into consecutive chunks of at most size elements.

Salesforce work is full of batch limits — how many IDs fit in a WHERE Id IN (...) clause before the query gets too long, how many records the Tooling API will delete in one call — and each of those limits ends up as the same hand-written index loop. This is that loop, once.

T

readonly T[]

The items to split. Not mutated.

number

Maximum number of items per chunk. Must be at least 1.

T[][]

The chunks, in order. Empty if items is empty.

If size is less than 1.