src/index.js
function _maybeAddWishToMatchPriorityArray(
  wish,
  matchPriority,
  matchPriorityArrays,
  currentMatchingWishIds,
) {
  const indexOfWishInCurrent = currentMatchingWishIds.indexOf(wish.id)
  if (matchPriority.matchType !== _matchRankMap.noMatch) {
    if (indexOfWishInCurrent === -1) {
      _getMatchPriorityArray(matchPriorityArrays, matchPriority).push(wish.id)
    }
  } else if (indexOfWishInCurrent !== -1) {
    // remove current matching wishIds if it doesn't match
    currentMatchingWishIds.splice(indexOfWishInCurrent, 1)
  }
}
function _maybeAddWishToMatchPriorityArray(
  wish,
  matchPriority,
  matchPriorityArrays,
  currentMatchingWishIds,
) {
  const indexOfWishInCurrent = currentMatchingWishIds.indexOf(wish.id)
  if (matchPriority.matchType !== _matchRankMap.noMatch) {
    if (indexOfWishInCurrent === -1) {
      _getMatchPriorityArray(matchPriorityArrays, matchPriority).push(wish.id)
    }
  } else if (indexOfWishInCurrent !== -1) {
    // remove current matching wishIds if it doesn't match
    currentMatchingWishIds.splice(indexOfWishInCurrent, 1)
  }
}
function _maybeAddWishToMatchPriorityArray ( wish , matchPriority , matchPriorityArrays , currentMatchingWishIds , ) { const indexOfWishInCurrent = currentMatchingWishIds . indexOf ( wish . id ) if ( matchPriority . matchType !== _matchRankMap . noMatch ) { if ( indexOfWishInCurrent === - 1 ) { _getMatchPriorityArray ( matchPriorityArrays , matchPriority ) . push ( wish . id ) } } else if ( indexOfWishInCurrent !== - 1 ) { // remove current matching wishIds if it doesn't match currentMatchingWishIds . splice ( indexOfWishInCurrent , 1 ) } }
If the wish has a matchType which is not equal to the _matchRankMap.noMatch
and it is not contained in the currentMatchingWishIds, then it is added to
the matchPriorityArrays based on the matchPriority.
@param {wish} wish
@param {MatchPriority} matchPriority
@param {Array.<Array>} matchPriorityArrays
@param {wishIds} currentMatchingWishIds
@private
If the wish has a matchType which is not equal to the _matchRankMap . noMatch and it is not contained in the currentMatchingWishIds then it is added to the matchPriorityArrays based on the matchPriority .