Simple full-featured finite state machine for your project
Find a file
2019-10-19 20:06:18 +03:00
src fix: fix bug with types 2019-10-19 20:06:18 +03:00
.gitignore Initial commit 2019-10-11 14:57:31 +03:00
jest.config.js Initial commit 2019-10-11 14:57:31 +03:00
LICENSE Initial commit 2019-10-11 14:57:31 +03:00
package-lock.json fix: fix bug with types 2019-10-19 20:06:18 +03:00
package.json fix: fix bug with types 2019-10-19 20:06:18 +03:00
README.md fix: fix int enum bugs 2019-10-17 13:55:49 +03:00
tsconfig.json fix: fix bug with types 2019-10-19 20:06:18 +03:00

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(() => {
    
  });
}