# von

> Finite State Machine

Latest version **0.1.1** (published 2016-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install von
pnpm add von
yarn add von
bun add von
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-05-27 |
| First published | 2016-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Thomas Coats |
| Maintainers | tcoats |
| Keywords | fsm |

## Links

- npm: https://www.npmjs.com/package/von
- Repository: https://github.com/tcoats/von
- Homepage: https://github.com/tcoats/von#readme
- Issues: https://github.com/tcoats/von/issues
- npm.io page: https://npm.io/package/von

## Recent versions

- 0.1.1 (latest) — 2016-05-27

## README

# von
Finite State Machine

```js
var fsm = require('von');
var consumption = fsm([
  { action: 'eat', from: 'hungry', to: 'satisfied'},
  { action: 'eat', from: 'satisfied', to: 'full' },
  { action: 'eat', from: 'full', to: 'sick' },
  { action: 'rest', from: ['hungry', 'satisfied', 'full', 'sick'], to: 'hungry' }
]);
var bug = consumption('hungry', {
  onrest: function(action, from, to) {
    console.log('Phew');
  },
  exithungry: function(action, from, to, food) {
    console.log("I can survive, ate " + food);
  },
  entersick: function(action, from, to, food) {
    console.log(food + " was too much!");
  }
});
console.log(bug.state);
bug.eat('grass');
console.log(bug.state);
bug.eat('grass');
console.log(bug.state);
bug.eat('grass');
console.log(bug.state);
bug.rest();
```

---
_Source: https://npm.io/package/von · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
