src/utils/StringMatch.js
function findMatchingSpecial() {
            // used to loop through the specials
            var i;

            for (i = specialsCounter; i < specials.length; i++) {
                // short circuit this search when we know there are no matches following
                if (specials[i] >= deadBranches[queryCounter]) {
                    break;
                }

                // First, ensure that we're not comparing specials that
                // come earlier in the string than our current search position.
                // This can happen when the string position changes elsewhere.
                if (specials[i] < strCounter) {
                    specialsCounter = i;
                } else if (query[queryCounter] === str[specials[i]]) {
                    // we have a match! do the required tracking
                    strCounter = specials[i];

                    // Upper case match check:
                    // If the query and original string matched, but the original string
                    // and the lower case version did not, that means that the original
                    // was upper case.
                    var upper = originalQuery[queryCounter] === originalStr[strCounter] && originalStr[strCounter] !== str[strCounter];
                    result.push(new SpecialMatch(strCounter, upper));
                    specialsCounter = i;
                    queryCounter++;
                    strCounter++;
                    return true;
                }
            }

            return false;
        }
function findMatchingSpecial() {
            // used to loop through the specials
            var i;

            for (i = specialsCounter; i < specials.length; i++) {
                // short circuit this search when we know there are no matches following
                if (specials[i] >= deadBranches[queryCounter]) {
                    break;
                }

                // First, ensure that we're not comparing specials that
                // come earlier in the string than our current search position.
                // This can happen when the string position changes elsewhere.
                if (specials[i] < strCounter) {
                    specialsCounter = i;
                } else if (query[queryCounter] === str[specials[i]]) {
                    // we have a match! do the required tracking
                    strCounter = specials[i];

                    // Upper case match check:
                    // If the query and original string matched, but the original string
                    // and the lower case version did not, that means that the original
                    // was upper case.
                    var upper = originalQuery[queryCounter] === originalStr[strCounter] && originalStr[strCounter] !== str[strCounter];
                    result.push(new SpecialMatch(strCounter, upper));
                    specialsCounter = i;
                    queryCounter++;
                    strCounter++;
                    return true;
                }
            }

            return false;
        }
function findMatchingSpecial ( ) { // used to loop through the specials var i ; for ( i = specialsCounter ; i < specials . length ; i ++ ) { // short circuit this search when we know there are no matches following if ( specials [ i ] >= deadBranches [ queryCounter ] ) { break ; } // First, ensure that we're not comparing specials that // come earlier in the string than our current search position. // This can happen when the string position changes elsewhere. if ( specials [ i ] < strCounter ) { specialsCounter = i ; } else if ( query [ queryCounter ] === str [ specials [ i ] ] ) { // we have a match! do the required tracking strCounter = specials [ i ] ; // Upper case match check: // If the query and original string matched, but the original string // and the lower case version did not, that means that the original // was upper case. var upper = originalQuery [ queryCounter ] === originalStr [ strCounter ] && originalStr [ strCounter ] !== str [ strCounter ] ; result . push ( new SpecialMatch ( strCounter , upper ) ) ; specialsCounter = i ; queryCounter ++ ; strCounter ++ ; return true ; } } return false ; }
Compares the current character from the query string against the special characters in str. Returns true if a match was found, false otherwise.
Compares the current character from the query string against the special characters in str . Returns true if a match was found false otherwise .