first commit
This commit is contained in:
commit
8bf1d1b928
47 files changed
+8648
No files matched your search
@@ -0,0 +1,11 @@
|
||||
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) }
|
||||
}
|
||||
Reference in new issue
Block a user