const { DeterministicFiniteAutomaton } = require('fauton');
const startsWithBC = new DeterministicFiniteAutomaton(
(inputString) => inputString.startsWith('bc'),
{
alphabets: ['a', 'b'],
states: ['A', 'B', 'C'],
transitions: {
A: ['B', 'A'],
B: ['A', 'B'],
},
}
);
Transition for state 'C' is not present, but no error is thrown. Ideally, the user should provide all the states in the transition map, but if not an error should be generated as that's the condition of a dfa.