Matches an object of options against an `EventContext` like object that contains `path` and `verb` attributes. Internally Sammy uses this for matching `before()` filters against specific options. You can set the object to _only_ match certain paths or verbs, or match all paths or verbs _except_ those that match the options.  ### Example  var app = $.sammy(), context = {verb: 'get', path: '#/mypath'};  // match against a path string app.contextMatchesOptions(context, '#/mypath'); //=> true app.contextMatchesOptions(context, '#/otherpath'); //=> false // equivilent to app.contextMatchesOptions(context, {only: {path:'#/mypath'}}); //=> true app.contextMatchesOptions(context, {only: {path:'#/otherpath'}}); //=> false // match against a path regexp app.contextMatchesOptions(context, /path/); //=> true app.contextMatchesOptions(context, /^path/); //=> false // match only a verb app.contextMatchesOptions(context, {only: {verb:'get'}}); //=> true app.contextMatchesOptions(context, {only: {verb:'post'}}); //=> false // match all except a verb app.contextMatchesOptions(context, {except: {verb:'post'}}); //=> true app.contextMatchesOptions(context, {except: {verb:'get'}}); //=> false // match all except a path app.contextMatchesOptions(context, {except: {path:'#/otherpath'}}); //=> true app.contextMatchesOptions(context, {except: {path:'#/mypath'}}); //=> false
function(context, match_options, positive) {
      // empty options always match
      var options = match_options;
      if (typeof options === 'undefined' || options == {}) {
        return true;
      }
      if (typeof positive === 'undefined') {
        positive = true;
      }
      // normalize options
      if (typeof options === 'string' || _isFunction(options.test)) {
        options = {path: options};
      }
      if (options.only) {
        return this.contextMatchesOptions(context, options.only, true);
      } else if (options.except) {
        return this.contextMatchesOptions(context, options.except, false);
      }
      var path_matched = true, verb_matched = true;
      if (options.path) {
        // wierd regexp test
        if (_isFunction(options.path.test)) {
          path_matched = options.path.test(context.path);
        } else {
          path_matched = (options.path.toString() === context.path);
        }
      }
      if (options.verb) {
        verb_matched = options.verb === context.verb;
      }
      return positive ? (verb_matched && path_matched) : !(verb_matched && path_matched);
    }