Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Extract consecutive boost value to variable.
Browse files Browse the repository at this point in the history
Per review feedback
  • Loading branch information
dangoor committed Apr 24, 2013
1 parent c667fcb commit 1552890
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/utils/StringMatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,19 +573,18 @@ define(function (require, exports, module) {

numConsecutive++;

var boost = CONSECUTIVE_MATCHES_POINTS * numConsecutive;

// Consecutive matches that started on a special are a
// good indicator of intent, so we award an added bonus there.
if (currentRangeStartedOnSpecial) {
newPoints += CONSECUTIVE_MATCHES_POINTS * numConsecutive;
if (DEBUG_SCORES) {
scoreDebug.consecutive += CONSECUTIVE_MATCHES_POINTS * numConsecutive;
}
boost = boost * 2;
}

if (DEBUG_SCORES) {
scoreDebug.consecutive += CONSECUTIVE_MATCHES_POINTS * numConsecutive;
scoreDebug.consecutive += boost;
}
newPoints += CONSECUTIVE_MATCHES_POINTS * numConsecutive;
newPoints += boost;
} else {
numConsecutive = 1;
}
Expand Down

0 comments on commit 1552890

Please sign in to comment.