lib/spray.js
function caller(instances, index, options) {
  // at the moment we are only calling the first event,
  // but lets start prepare the api for managin an array of events
  return instances(options).then(function (_ref) {
    var event = _ref.event,
        eventName = _ref.eventName;

    var shouldExit = typeof options.tick === 'function' ? options.tick(event, index) : false;

    var newIndex = index + 1;
    // if we havent reached the end of our cycle return a new caller
    // otherwise just exit the recursive function
    var eventObj = _eventProps2.default[eventName];
    return newIndex >= options.steps || shouldExit ? event : caller(instances, newIndex, Object.assign({}, options, handlePathObj(options.path, event, eventObj, newIndex)));
  });
}
function caller(instances, index, options) {
  // at the moment we are only calling the first event,
  // but lets start prepare the api for managin an array of events
  return instances(options).then(function (_ref) {
    var event = _ref.event,
        eventName = _ref.eventName;

    var shouldExit = typeof options.tick === 'function' ? options.tick(event, index) : false;

    var newIndex = index + 1;
    // if we havent reached the end of our cycle return a new caller
    // otherwise just exit the recursive function
    var eventObj = _eventProps2.default[eventName];
    return newIndex >= options.steps || shouldExit ? event : caller(instances, newIndex, Object.assign({}, options, handlePathObj(options.path, event, eventObj, newIndex)));
  });
}
function caller ( instances , index , options ) { // at the moment we are only calling the first event, // but lets start prepare the api for managin an array of events return instances ( options ) . then ( function ( _ref ) { var event = _ref . event , eventName = _ref . eventName ; var shouldExit = typeof options . tick === 'function' ? options . tick ( event , index ) : false ; var newIndex = index + 1 ; // if we havent reached the end of our cycle return a new caller // otherwise just exit the recursive function var eventObj = _eventProps2 . default [ eventName ] ; return newIndex >= options . steps || shouldExit ? event : caller ( instances , newIndex , Object . assign ( { } , options , handlePathObj ( options . path , event , eventObj , newIndex ) ) ) ; } ) ; }
Recursive function to be called as many times as we defined the steps count

@param {Array} instances
@param {Integer} index
@param {Object} options
Recursive function to be called as many times as we defined the steps count