Files
tabletop-web/src/games/onecard/history.ts
T
2026-06-22 15:17:05 +09:00

12 lines
427 B
TypeScript

import type { GameAction } from './types'
export function pushAction(history: GameAction[], action: GameAction): GameAction[] {
return [...history, action]
}
export function popAction(history: GameAction[]): { action: GameAction | null; history: GameAction[] } {
if (history.length === 0) return { action: null, history }
const action = history[history.length - 1]!
return { action, history: history.slice(0, -1) }
}