lib/State.js
function State(config) {
  this._ = require('lodash');

  this._name = config.name;
  this._isInitial = config.isInitial;
  this._isTerminal = config.isTerminal;
  this._outgoingTransitions = config.outgoingTransitions;

  this.accept = config.accept;

  this._validateConfig(config);

  // Transform any value-based transition criteria to be a function
  this._.forEach(this._outgoingTransitions, function (transition) {
    var criteria = transition.criteria;

    // Replace the value-based criteria with a simple comparison function
    if (typeof criteria !== 'function') {
      transition.criteria = function (input) {
        return (input === criteria);
      }
    }
  });
}
function State(config) {
  this._ = require('lodash');

  this._name = config.name;
  this._isInitial = config.isInitial;
  this._isTerminal = config.isTerminal;
  this._outgoingTransitions = config.outgoingTransitions;

  this.accept = config.accept;

  this._validateConfig(config);

  // Transform any value-based transition criteria to be a function
  this._.forEach(this._outgoingTransitions, function (transition) {
    var criteria = transition.criteria;

    // Replace the value-based criteria with a simple comparison function
    if (typeof criteria !== 'function') {
      transition.criteria = function (input) {
        return (input === criteria);
      }
    }
  });
}
function State ( config ) { this . _ = require ( 'lodash' ) ; this . _name = config . name ; this . _isInitial = config . isInitial ; this . _isTerminal = config . isTerminal ; this . _outgoingTransitions = config . outgoingTransitions ; this . accept = config . accept ; this . _validateConfig ( config ) ; // Transform any value-based transition criteria to be a function this . _ . forEach ( this . _outgoingTransitions , function ( transition ) { var criteria = transition . criteria ; // Replace the value-based criteria with a simple comparison function if ( typeof criteria !== 'function' ) { transition . criteria = function ( input ) { return ( input === criteria ) ; } } } ) ; }
Represents an automata or state within a Finite State Machine.

Provides mechanisms for
Represents an automata or state within a Finite State Machine .