Simple full-featured finite state machine for your project
Dmitriy Pleshevskiy
1d6640db8f
typescript >= 4.0.5 jest >= 26.6.3 ts-jest >= 26.4.3 @types/jest >= 26.0.15 coveralls >= 3.1.0 lodash.clonedeep >= 4.5.0 |
||
---|---|---|
src | ||
tests | ||
.gitignore | ||
.travis.yml | ||
jest.config.js | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md | ||
tsconfig.json |
IT FSM
Simple finite state machine
Installation
npm install --save it-fsm
Usage
import { StateMachine } from 'it-fsm';
const fsm = new StateMachine('TODO', {
TODO: {
complete: 'COMPLETE'
}
})
if (fsm.can('complete')) {
fsm.complete().then(() => {
})
}
// or
if (fsm.canToState('COMPLETE')) {
fsm.complete().then(() => {
});
}