lib/utils/string.js
function uniqueMatch(string, regexp) {
  const results = [];
  let match;

  while ((match = regexp.exec(string))) {
    results.push({
      context: match[0],
      match: match[1] || ''
    });
  }

  // Filter duplicates
  return unique(results, isEqual);
}
function uniqueMatch(string, regexp) {
  const results = [];
  let match;

  while ((match = regexp.exec(string))) {
    results.push({
      context: match[0],
      match: match[1] || ''
    });
  }

  // Filter duplicates
  return unique(results, isEqual);
}
function uniqueMatch ( string , regexp ) { const results = [ ] ; let match ; while ( ( match = regexp . exec ( string ) ) ) { results . push ( { context : match [ 0 ] , match : match [ 1 ] || '' } ) ; } // Filter duplicates return unique ( results , isEqual ) ; }
Match unique occurrences in 'string'
@param {String} string
@param {RegExp} regexp
@returns {Array}
Match unique occurrences in string