traverse/incoming.js
function middleware(branch, payload, callback)
{
  // get proper name
  var normalized = normalize(branch);

  this.logger.debug({message: 'Running middleware for incoming payload', branch: branch, normalized: normalized, payload: payload});

  // add branch reference to the parent object

  // run through all registered middleware
  this._run(normalized, payload, function(error, resolvedPayload)
  {
    var normalizeType;

    if (payload.type)
    {
      normalizeType = normalize(payload.type);
      this._run([normalized, normalizeType].join('.'), resolvedPayload, callback);
    }
    // be done here
    else
    {
      callback(error, resolvedPayload);
    }
  }.bind(this));
}
function middleware(branch, payload, callback)
{
  // get proper name
  var normalized = normalize(branch);

  this.logger.debug({message: 'Running middleware for incoming payload', branch: branch, normalized: normalized, payload: payload});

  // add branch reference to the parent object

  // run through all registered middleware
  this._run(normalized, payload, function(error, resolvedPayload)
  {
    var normalizeType;

    if (payload.type)
    {
      normalizeType = normalize(payload.type);
      this._run([normalized, normalizeType].join('.'), resolvedPayload, callback);
    }
    // be done here
    else
    {
      callback(error, resolvedPayload);
    }
  }.bind(this));
}
function middleware ( branch , payload , callback ) { // get proper name var normalized = normalize ( branch ) ; this . logger . debug ( { message : 'Running middleware for incoming payload' , branch : branch , normalized : normalized , payload : payload } ) ; // add branch reference to the parent object // run through all registered middleware this . _run ( normalized , payload , function ( error , resolvedPayload ) { var normalizeType ; if ( payload . type ) { normalizeType = normalize ( payload . type ) ; this . _run ( [ normalized , normalizeType ] . join ( '.' ) , resolvedPayload , callback ) ; } // be done here else { callback ( error , resolvedPayload ) ; } } . bind ( this ) ) ; }
Traverse middleware for incoming flow

@this  Fbbot#
@param {string} branch - branch name of the payload
@param {object} payload - initial payload object from facebook messenger
@param {function} callback - invoked upon error or when all entries were processed
Traverse middleware for incoming flow