refactor(utils): share chunkItems helper

This commit is contained in:
Peter Steinberger
2026-02-16 01:52:30 +00:00
parent 618008b483
commit 19f53543d2
3 changed files with 12 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ import {
readChannelAllowFromStore,
upsertChannelPairingRequest,
} from "../../pairing/pairing-store.js";
import { chunkItems } from "../../utils/chunk-items.js";
import {
normalizeAllowList,
normalizeAllowListLower,
@@ -38,17 +39,6 @@ async function getCommandsRegistry(): Promise<CommandsRegistry> {
return commandsRegistry;
}
function chunkItems<T>(items: T[], size: number): T[][] {
if (size <= 0) {
return [items];
}
const rows: T[][] = [];
for (let i = 0; i < items.length; i += size) {
rows.push(items.slice(i, i + size));
}
return rows;
}
function encodeSlackCommandArgValue(parts: {
command: string;
arg: string;