mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 22:11:23 +00:00
refactor(utils): share chunkItems helper
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user