mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-05 17:41:37 +00:00
Adds broad inline comments and JSDoc for CLI, cron, outbound/channel, plugin SDK, ACP, shared helpers, net policy, and related utility contracts. Proof: git diff --check on latest exact head plus focused cron tests passed; CI had no failing checks observed before merge attempt.
12 lines
373 B
TypeScript
12 lines
373 B
TypeScript
/** Splits items into fixed-size chunks, preserving order and returning one row for non-positive sizes. */
|
|
export function chunkItems<T>(items: readonly T[], size: number): T[][] {
|
|
if (size <= 0) {
|
|
return [Array.from(items)];
|
|
}
|
|
const rows: T[][] = [];
|
|
for (let i = 0; i < items.length; i += size) {
|
|
rows.push(items.slice(i, i + size));
|
|
}
|
|
return rows;
|
|
}
|