Simple full-featured finite state machine for your project
da6bed2d77
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21) Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
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(() => {
});
}