Export StateMachine

This commit is contained in:
mindfulminun committed 2023-09-03 01:43:24 -05:00
1 parent b8e0fcb8d1
commit 6834c45ac1
2 files changed
+4 -8

No files matched your search

+2 -2
View File
@@ -1,10 +1,10 @@
type Transition<State extends string | number | symbol, InputAlphabet, Context> = (
export type Transition<State extends string | number | symbol, InputAlphabet, Context> = (
this: StateMachine<State, InputAlphabet, Context>,
input: InputAlphabet,
machine: StateMachine<State, InputAlphabet, Context>
) => void
class StateMachine<State extends string | number | symbol = 0, InputAlphabet = string, Context = null> {
export class StateMachine<State extends string | number | symbol = 0, InputAlphabet = string, Context = null> {
#initialState: State
#transitionTable: Partial<Record<State, Transition<State, InputAlphabet, Context>>>
#acceptStates: Set<State>