Simple full-featured finite state machine for your project
Find a file
2021-08-23 11:33:55 +03:00
.github/workflows chore: improve makefile commands 2021-08-21 08:53:36 +03:00
.vscode chore: add tab size for vscode 2021-08-21 08:54:07 +03:00
examples chore: add turnstile example 2021-08-23 11:33:20 +03:00
.gitignore chore: remove dest from repo 2021-08-20 11:13:30 +03:00
fsm.test.ts feat: add actions 2021-08-23 11:23:41 +03:00
fsm.ts feat: add actions 2021-08-23 11:23:41 +03:00
LICENSE chore: change licence 2021-08-20 11:21:12 +03:00
makefile chore: improve makefile commands 2021-08-21 08:53:36 +03:00
package.json fix: remove files from package.json 2021-08-20 11:20:55 +03:00
README.md doc: update readme 2021-08-23 11:33:55 +03:00
tsconfig.json chore: remove dom from ts lib 2021-08-20 11:21:53 +03:00

IT FSM

ci Coverage Status

Simple full-featured finite state machine for your project

Why it-fsm?

  • 🚯 333 LOC - 0 dependencies
  • 🍒 Sophisticated object-oriented design

Getting started

import { StateMachineBuilder } from "it-fsm";

const [locked, unlocked] = ['locked', 'unlocked'] as const;

const sm = new StateMachineBuilder()
  .withStates([locked, unlocked])
  .withTransitions([
    [locked, { coin: unlocked }],
    [unlocked, { push: locked }],
  ])
  .build(locked);

or with deno

import { StateMachineBuilder } from "https://raw.githubusercontent.com/icetemple/it-fsm/master/fsm.ts";

// ...

You can find the full example in the examples folder.

Install

If you want to use it in Node.js or the browser, you may need to install it as follows

npm install --save it-fsm