packages/rebound-router/lib/rebound-router.js
function(route, name, callback) {
    if (_.isFunction(name)) {
      callback = name;
      name = '';
    }

    if (!_.isRegExp(route)){
      route = this._routeToRegExp(route);
    }

    if (!callback){ callback = this[name]; }
    Backbone.history.route(route, (fragment) => {

      // If this route was defined as a regular expression, we don't capture
      // query params. Only parse the actual path.
      fragment = fragment.split('?')[0];

      // Extract the arguments we care about from the fragment
      var args = this._extractParameters(route, fragment);

      // Get the query params string
      var search = (Backbone.history.getSearch() || '').slice(1);

      // If this route was created from a string (not a regexp), remove the auto-captured
      // search params.
      if(route._isString){ args.pop(); }

      // If the route is not user prodided, if the history object has search params
      // then our args have the params as its last agrument as of Backbone 1.2.0
      // If the route is a user provided regex, add in parsed search params from
      // the history object before passing to the callback.
      args.push((search) ? $.url.query.parse(search) : {});

      var resp = this.execute(callback, args, name);
      if ( resp !== false) {
        this.trigger.apply(this, ['route:' + name].concat(args));
        this.trigger('route', name, args);
        Backbone.history.trigger('route', this, name, args);
      }
      return resp;
    });
    return this;
  }
function(route, name, callback) {
    if (_.isFunction(name)) {
      callback = name;
      name = '';
    }

    if (!_.isRegExp(route)){
      route = this._routeToRegExp(route);
    }

    if (!callback){ callback = this[name]; }
    Backbone.history.route(route, (fragment) => {

      // If this route was defined as a regular expression, we don't capture
      // query params. Only parse the actual path.
      fragment = fragment.split('?')[0];

      // Extract the arguments we care about from the fragment
      var args = this._extractParameters(route, fragment);

      // Get the query params string
      var search = (Backbone.history.getSearch() || '').slice(1);

      // If this route was created from a string (not a regexp), remove the auto-captured
      // search params.
      if(route._isString){ args.pop(); }

      // If the route is not user prodided, if the history object has search params
      // then our args have the params as its last agrument as of Backbone 1.2.0
      // If the route is a user provided regex, add in parsed search params from
      // the history object before passing to the callback.
      args.push((search) ? $.url.query.parse(search) : {});

      var resp = this.execute(callback, args, name);
      if ( resp !== false) {
        this.trigger.apply(this, ['route:' + name].concat(args));
        this.trigger('route', name, args);
        Backbone.history.trigger('route', this, name, args);
      }
      return resp;
    });
    return this;
  }
function ( route , name , callback ) { if ( _ . isFunction ( name ) ) { callback = name ; name = '' ; } if ( ! _ . isRegExp ( route ) ) { route = this . _routeToRegExp ( route ) ; } if ( ! callback ) { callback = this [ name ] ; } Backbone . history . route ( route , ( fragment ) => { // If this route was defined as a regular expression, we don't capture // query params. Only parse the actual path. fragment = fragment . split ( '?' ) [ 0 ] ; // Extract the arguments we care about from the fragment var args = this . _extractParameters ( route , fragment ) ; // Get the query params string var search = ( Backbone . history . getSearch ( ) || '' ) . slice ( 1 ) ; // If this route was created from a string (not a regexp), remove the auto-captured // search params. if ( route . _isString ) { args . pop ( ) ; } // If the route is not user prodided, if the history object has search params // then our args have the params as its last agrument as of Backbone 1.2.0 // If the route is a user provided regex, add in parsed search params from // the history object before passing to the callback. args . push ( ( search ) ? $ . url . query . parse ( search ) : { } ) ; var resp = this . execute ( callback , args , name ) ; if ( resp !== false ) { this . trigger . apply ( this , [ 'route:' + name ] . concat ( args ) ) ; this . trigger ( 'route' , name , args ) ; Backbone . history . trigger ( 'route' , this , name , args ) ; } return resp ; } ) ; return this ; }
Override route so if callback returns false, the route event is not triggered Every route also looks for query params, parses with QS, and passes the extra variable as a POJO to callbacks
Override route so if callback returns false the route event is not triggered Every route also looks for query params parses with QS and passes the extra variable as a POJO to callbacks