lib/highlighter.js
function(subject, search) {
    var matches = search.exec(subject);
    if (matches) {
      return {
        first: matches.index,
        last: matches.index + matches[0].length
      };
    }
  }
function(subject, search) {
    var matches = search.exec(subject);
    if (matches) {
      return {
        first: matches.index,
        last: matches.index + matches[0].length
      };
    }
  }
function ( subject , search ) { var matches = search . exec ( subject ) ; if ( matches ) { return { first : matches . index , last : matches . index + matches [ 0 ] . length } ; } }
Get the indexes of the first and last characters of the matched string.

@param  {string} subject
The string to search against.

@param  {RegExp} search
The regex search query.

@return {Object}
An object consisting of "first" and "last" properties representing the
indexes of the first and last characters of a matching string.
Get the indexes of the first and last characters of the matched string .