function _matchRules(rules, key) {
  if (rules.exact && rules.exact.test(key)) {
    return EXACT_MATCH
  }

  const wildcard = rules.wildcard
  if (!wildcard) {
    return NO_MATCH
  }

  wildcard.lastIndex = 0
  return wildcard.test(key) ? wildcard.lastIndex + 1 : NO_MATCH
}
Tests the given key against the given rule set.

This method assumes that the rule set is sorted from best possible match to
least possible match. Unsorted lists may result in a lesser score being given
to the value.

@private
@param {Array.<string>}  rules - The set of rules to match against.
@param {string}          key   - The name of the attribute to look for.
@returns {number} The strength of the match, from `0` for no-match to `Infinity`
 for exact matches.