src/services/state-router.js
function(name, data) {
    if(name === null || typeof name === 'undefined') {
      throw new Error('Name cannot be null.');
    
    // Only use valid state names
    } else if(!_validateStateName(name)) {
      throw new Error('Invalid state name.');
    }

    // Create state
    var state = angular.copy(data);

    // Use defaults
    _setStateDefaults(state);

    // Named state
    state.name = name;

    // Set definition
    _stateLibrary[name] = state;

    // Reset cache
    _stateCache = {};

    // URL mapping
    if(state.url) {
      _urlDictionary.add(state.url, state);
    }

    return data;
  }
function(name, data) {
    if(name === null || typeof name === 'undefined') {
      throw new Error('Name cannot be null.');
    
    // Only use valid state names
    } else if(!_validateStateName(name)) {
      throw new Error('Invalid state name.');
    }

    // Create state
    var state = angular.copy(data);

    // Use defaults
    _setStateDefaults(state);

    // Named state
    state.name = name;

    // Set definition
    _stateLibrary[name] = state;

    // Reset cache
    _stateCache = {};

    // URL mapping
    if(state.url) {
      _urlDictionary.add(state.url, state);
    }

    return data;
  }
function ( name , data ) { if ( name === null || typeof name === 'undefined' ) { throw new Error ( 'Name cannot be null.' ) ; // Only use valid state names } else if ( ! _validateStateName ( name ) ) { throw new Error ( 'Invalid state name.' ) ; } // Create state var state = angular . copy ( data ) ; // Use defaults _setStateDefaults ( state ) ; // Named state state . name = name ; // Set definition _stateLibrary [ name ] = state ; // Reset cache _stateCache = { } ; // URL mapping if ( state . url ) { _urlDictionary . add ( state . url , state ) ; } return data ; }
Internal method to store a state definition.  Parameters should be included in data Object not state name.

@param  {String} name A unique identifier for the state; using state-notation
@param  {Object} data A state definition data Object
@return {Object}      A state data Object
Internal method to store a state definition . Parameters should be included in data Object not state name .