Simple full-featured finite state machine for your project
Go to file
Dmitriy Pleshevskiy 58d8285256
change licence, change repo
2022-06-21 16:56:49 +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 style: fmt examples 2021-08-23 11:40:13 +03:00
.gitignore chore: remove dest from repo 2021-08-20 11:13:30 +03:00
COPYING change licence, change repo 2022-06-21 16:56:49 +03:00
README.md change licence, change repo 2022-06-21 16:56:49 +03:00
deno.json change licence, change repo 2022-06-21 16:56:49 +03:00
fsm.test.ts feat: add actions 2021-08-23 11:23:41 +03:00
fsm.ts change licence, change repo 2022-06-21 16:56:49 +03:00
makefile chore: improve makefile commands 2021-08-21 08:53:36 +03:00
package.json change licence, change repo 2022-06-21 16:56:49 +03:00
tsconfig.json chore: use es2017 lib 2021-08-23 11:44:21 +03:00

README.md

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);

You can find the full example in the examples folder.

Installation

if you use the Deno, just add following to your import_map.json

{
  "imports": {
    "it-fsm": "https://git.pleshevski.ru/pleshevskiy/it-fsm/src/commit/c182728810e9fabcb6bb2b3091bbeabf439bef2d/fsm.ts"
  }
}

or you can use branch https://git.pleshevski.ru/pleshevskiy/paren/raw/branch/main/

Note: Use always a specific commit instead of branch

If you use the Node.js or in a browser as ES module, you may need to install it as follows, and additionally you can add import maps for client side.

npm install --save it-fsm

License

GNU General Public License v3.0 or later

See COPYING to see the full text.