src/keyboard.js
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
      var i,
          callback,
          matches = [],
          action = e.type;

      // if there are no events related to this keycode
      if (!this._callbacks[character]) {
          return [];
      }

      // if a modifier key is coming up on its own we should allow it
      if (action == 'keyup' && _isModifier(character)) {
          modifiers = [character];
      }

      // loop through all callbacks for the key that was pressed
      // and see if any of them match
      for (i = 0; i < this._callbacks[character].length; ++i) {
          callback = this._callbacks[character][i];

          // if a sequence name is not specified, but this is a sequence at
          // the wrong level then move onto the next match
          if (!sequenceName && callback.seq && this._sequenceLevels[callback.seq] != callback.level) {
              continue;
          }

          // if the action we are looking for doesn't match the action we got
          // then we should keep going
          if (action != callback.action) {
              continue;
          }

          // if this is a keypress event and the meta key and control key
          // are not pressed that means that we need to only look at the
          // character, otherwise check the modifiers as well
          //
          // chrome will not fire a keypress if meta or control is down
          // safari will fire a keypress if meta or meta+shift is down
          // firefox will fire a keypress if meta or control is down
          if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {

              // when you bind a combination or sequence a second time it
              // should overwrite the first one.  if a sequenceName or
              // combination is specified in this call it does just that
              //
              // @todo make deleting its own method?
              var deleteCombo = !sequenceName && callback.combo == combination;
              var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
              if (deleteCombo || deleteSequence) {
                  this._callbacks[character].splice(i, 1);
              }

              matches.push(callback);
          }
      }

      return matches;
  }
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
      var i,
          callback,
          matches = [],
          action = e.type;

      // if there are no events related to this keycode
      if (!this._callbacks[character]) {
          return [];
      }

      // if a modifier key is coming up on its own we should allow it
      if (action == 'keyup' && _isModifier(character)) {
          modifiers = [character];
      }

      // loop through all callbacks for the key that was pressed
      // and see if any of them match
      for (i = 0; i < this._callbacks[character].length; ++i) {
          callback = this._callbacks[character][i];

          // if a sequence name is not specified, but this is a sequence at
          // the wrong level then move onto the next match
          if (!sequenceName && callback.seq && this._sequenceLevels[callback.seq] != callback.level) {
              continue;
          }

          // if the action we are looking for doesn't match the action we got
          // then we should keep going
          if (action != callback.action) {
              continue;
          }

          // if this is a keypress event and the meta key and control key
          // are not pressed that means that we need to only look at the
          // character, otherwise check the modifiers as well
          //
          // chrome will not fire a keypress if meta or control is down
          // safari will fire a keypress if meta or meta+shift is down
          // firefox will fire a keypress if meta or control is down
          if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {

              // when you bind a combination or sequence a second time it
              // should overwrite the first one.  if a sequenceName or
              // combination is specified in this call it does just that
              //
              // @todo make deleting its own method?
              var deleteCombo = !sequenceName && callback.combo == combination;
              var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
              if (deleteCombo || deleteSequence) {
                  this._callbacks[character].splice(i, 1);
              }

              matches.push(callback);
          }
      }

      return matches;
  }
function _getMatches ( character , modifiers , e , sequenceName , combination , level ) { var i , callback , matches = [ ] , action = e . type ; // if there are no events related to this keycode if ( ! this . _callbacks [ character ] ) { return [ ] ; } // if a modifier key is coming up on its own we should allow it if ( action == 'keyup' && _isModifier ( character ) ) { modifiers = [ character ] ; } // loop through all callbacks for the key that was pressed // and see if any of them match for ( i = 0 ; i < this . _callbacks [ character ] . length ; ++ i ) { callback = this . _callbacks [ character ] [ i ] ; // if a sequence name is not specified, but this is a sequence at // the wrong level then move onto the next match if ( ! sequenceName && callback . seq && this . _sequenceLevels [ callback . seq ] != callback . level ) { continue ; } // if the action we are looking for doesn't match the action we got // then we should keep going if ( action != callback . action ) { continue ; } // if this is a keypress event and the meta key and control key // are not pressed that means that we need to only look at the // character, otherwise check the modifiers as well // // chrome will not fire a keypress if meta or control is down // safari will fire a keypress if meta or meta+shift is down // firefox will fire a keypress if meta or control is down if ( ( action == 'keypress' && ! e . metaKey && ! e . ctrlKey ) || _modifiersMatch ( modifiers , callback . modifiers ) ) { // when you bind a combination or sequence a second time it // should overwrite the first one.  if a sequenceName or // combination is specified in this call it does just that // // @todo make deleting its own method? var deleteCombo = ! sequenceName && callback . combo == combination ; var deleteSequence = sequenceName && callback . seq == sequenceName && callback . level == level ; if ( deleteCombo || deleteSequence ) { this . _callbacks [ character ] . splice ( i , 1 ) ; } matches . push ( callback ) ; } } return matches ; }
finds all callbacks that match based on the keycode, modifiers,
and action

@param {string} character
@param {Array} modifiers
@param {Event|Object} e
@param {string=} sequenceName - name of the sequence we are looking for
@param {string=} combination
@param {number=} level
@returns {Array}
finds all callbacks that match based on the keycode modifiers and action