Simple full-featured finite state machine for your project
Find a file
2021-05-10 22:26:49 +02:00
src feat: change object to map events and states 2020-11-08 05:50:20 +03:00
tests feat: change object to map events and states 2020-11-08 05:50:20 +03:00
.gitignore chore: change build destination 2020-11-06 06:13:43 +03:00
.travis.yml ci: remove node 8, add 14 2020-11-08 05:52:48 +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 chore(deps): bump lodash from 4.17.20 to 4.17.21 2021-05-10 16:57:17 +00:00
package.json chore: bump version 2020-11-06 06:16:01 +03:00
README.md ci: add coveralls badge 2019-10-19 20:33:15 +03:00
tsconfig.json chore: change build destination 2020-11-06 06:13:43 +03:00

IT FSM

Simple finite state machine

Build Status Coverage Status

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