<commit_before>fsmp
====

Promise-based asynchronous Finite State Machine for node/browserify

## Install
TODO: not yet published to npm.

    # npm install fsmp

## Usage

### Constructor

    var FSM = require('fsm');
    var fsm = new FSM();

### Define States

Use `#define()` to create a state.

    fsm.define({
      name: 'stateName',
      enter: function() {}, // callback when entering the state
      leave: function() {}, // callback before leaving the state
      onConflict: function(eventName, params) {}, // callback when event occurs before previous event finishes
      onMissing: function(eventName, params) {}, // callback when event name is not defined on this state
      eventName: function() { ... }
    })
    
Use `#initialize()` to start the fsm in its initial state. This will call the state's `enter()` callback.

    fsm.define({name:'start', ...})
    fsm.initialize('start')
    
Use `#emit()` to emit an event on the current state:

    fsm.emit('eventName', {...params...})<commit_msg>add notes on development workflow<commit_after>fsmp
====

Promise-based asynchronous Finite State Machine for node/browserify

## Install
TODO: not yet published to npm.

    # npm install fsmp
    
## Development Guide

    # install dependencies
    npm install
    # run unit tests
    npm test

## Usage

### Constructor

    var FSM = require('fsm');
    var fsm = new FSM();

### Define States

Use `#define()` to create a state.

    fsm.define({
      name: 'stateName',
      enter: function() {}, // callback when entering the state
      leave: function() {}, // callback before leaving the state
      onConflict: function(eventName, params) {}, // callback when event occurs before previous event finishes
      onMissing: function(eventName, params) {}, // callback when event name is not defined on this state
      eventName: function() { ... }
    })
    
Use `#initialize()` to start the fsm in its initial state. This will call the state's `enter()` callback.

    fsm.define({name:'start', ...})
    fsm.initialize('start')
    
Use `#emit()` to emit an event on the current state:

    fsm.emit('eventName', {...params...})
{'fraction_non_alphanumeric': 0.12939001848428835, 'fraction_numerical': 0.0, 'mean_word_length': 3.031657355679702, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '586415', 'n_tokens_mistral': 624, 'n_tokens_neox': 585, 'n_words': 232}