18 lines · 806 B · TypeScriptRaw
type Command = { id: string; sheet?: string };type Parts = { acts: { main: string | null; more: string[]; away: string | null }; cards?: { act?: string }[]; strip?: { act?: string }[];};/** The declared acts the record page deals, including cards in its strip and * section commands. Commands used only by a field's picker/sheet are slips. */export function dealtActs<T extends Command>(commands: T[], parts: Parts, sections: { commands?: string[] }[]): T[] { const ids = new Set([ parts.acts.main, ...parts.acts.more, parts.acts.away, ...(parts.cards ?? []).map((card) => card.act), ...(parts.strip ?? []).map((card) => card.act), ...sections.flatMap((section) => section.commands ?? []), ]); return commands.filter((command) => !command.sheet && ids.has(command.id));}