A tool to minimize State Machines for Node.js
$ npm install --save state-machine-minimizer
const smMinimizer = require('state-machine-minimizer');
const obj = {
q0: {
a: ['q2', 1],
b: ['q0', 1]
},
q1: {
a: ['q0', 0],
b: ['q2', 1]
},
q2: {
a: ['q0', 0],
b: ['q1', 1]
}
};
const objMinimized = smMinimizer.fromObj(obj);
The state machine object is definited like this:
{
state1: {
input1: [targetState, output],
...
inputN: [targetState, output]
},
etc...
};
Type: object
Type: string
Default: 'str'
The possible options are:
- 'str' return a stringify object;
- 'obj' return an object;
- 'smg' return a state-machine-graph class.
Type: string
The json path.
Type: smg class
Minimize the smg object.
- Emanuele Volanti - emavola
This project is licensed under the MIT License - see the LICENSE file for details.