src/index.js
function _bestMagicWordsMatch(wishesMagicWords, givenMagicWord) {
  const bestMatch = {
    matchType: _matchRankMap.noMatch,
    magicWordIndex: -1,
  }
  _each(wishesMagicWords, (wishesMagicWord, index) => {
    const matchRank = _stringsMatch(wishesMagicWord, givenMagicWord)
    if (matchRank > bestMatch.matchType) {
      bestMatch.matchType = matchRank
      bestMatch.magicWordIndex = index
    }
    return bestMatch.matchType !== _matchRankMap.equals
  })
  return bestMatch
}
function _bestMagicWordsMatch(wishesMagicWords, givenMagicWord) {
  const bestMatch = {
    matchType: _matchRankMap.noMatch,
    magicWordIndex: -1,
  }
  _each(wishesMagicWords, (wishesMagicWord, index) => {
    const matchRank = _stringsMatch(wishesMagicWord, givenMagicWord)
    if (matchRank > bestMatch.matchType) {
      bestMatch.matchType = matchRank
      bestMatch.magicWordIndex = index
    }
    return bestMatch.matchType !== _matchRankMap.equals
  })
  return bestMatch
}
function _bestMagicWordsMatch ( wishesMagicWords , givenMagicWord ) { const bestMatch = { matchType : _matchRankMap . noMatch , magicWordIndex : - 1 , } _each ( wishesMagicWords , ( wishesMagicWord , index ) => { const matchRank = _stringsMatch ( wishesMagicWord , givenMagicWord ) if ( matchRank > bestMatch . matchType ) { bestMatch . matchType = matchRank bestMatch . magicWordIndex = index } return bestMatch . matchType !== _matchRankMap . equals } ) return bestMatch }
Gets the best magic words match of the wish's magic words
@param {string|Array.<string>} wishesMagicWords
@param {string} givenMagicWord
@returns {MatchPriority}
@private
Gets the best magic words match of the wish s magic words