Simple full-featured finite state machine for your project
Find a file
2022-11-30 16:50:16 +03:00
.github/workflows fix github ci 2022-06-21 16:58:34 +03:00
assets doc: add project example to readme 2022-11-30 16:50:16 +03:00
examples doc: add project example to readme 2022-11-30 16:50:16 +03:00
.gitignore move dev dependencies to flake.nix 2022-11-19 16:33:13 +03:00
COPYING change licence, change repo 2022-06-21 16:56:49 +03:00
deno.json fix broken ci 2022-11-19 16:32:16 +03:00
deno.lock deps: bump deno std 2022-11-19 16:32:54 +03:00
flake.lock move dev dependencies to flake.nix 2022-11-19 16:33:13 +03:00
flake.nix move dev dependencies to flake.nix 2022-11-19 16:33:13 +03:00
fsm.test.ts deps: bump deno std 2022-11-19 16:32:54 +03:00
fsm.ts chore: change email 2022-11-17 18:51:48 +03:00
Makefile doc: add project example to readme 2022-11-30 16:50:16 +03:00
package.json move dev dependencies to flake.nix 2022-11-19 16:33:13 +03:00
README.md doc: add project example to readme 2022-11-30 16:50:16 +03:00
tsconfig.cjs.json fix: build package for nodejs 2022-11-17 18:51:48 +03:00
tsconfig.json fix: build package for nodejs 2022-11-17 18:51:48 +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);

You can find more examples here

Installation

Deno

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

{
  "imports": {
    "it-fsm": "https://git.pleshevski.ru/pleshevskiy/it-fsm/raw/tag/v2.0.3/fsm.ts"
  }
}

Node.js

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.