platform.js
function getProduct(guesses) {
      return reduce(guesses, function(result, guess) {
        var pattern = guess.pattern || qualify(guess);
        if (!result && (result =
              RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
              RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
              RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
            )) {
          // Split by forward slash and append product version if needed.
          if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
            result[0] += ' ' + result[1];
          }
          // Correct character case and cleanup string.
          guess = guess.label || guess;
          result = format(result[0]
            .replace(RegExp(pattern, 'i'), guess)
            .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
            .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
        }
        return result;
      });
    }
function getProduct(guesses) {
      return reduce(guesses, function(result, guess) {
        var pattern = guess.pattern || qualify(guess);
        if (!result && (result =
              RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
              RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
              RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
            )) {
          // Split by forward slash and append product version if needed.
          if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
            result[0] += ' ' + result[1];
          }
          // Correct character case and cleanup string.
          guess = guess.label || guess;
          result = format(result[0]
            .replace(RegExp(pattern, 'i'), guess)
            .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
            .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
        }
        return result;
      });
    }
function getProduct ( guesses ) { return reduce ( guesses , function ( result , guess ) { var pattern = guess . pattern || qualify ( guess ) ; if ( ! result && ( result = RegExp ( '\\b' + pattern + ' *\\d+[.\\w_]*' , 'i' ) . exec ( ua ) || RegExp ( '\\b' + pattern + ' *\\w+-[\\w]*' , 'i' ) . exec ( ua ) || RegExp ( '\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)' , 'i' ) . exec ( ua ) ) ) { // Split by forward slash and append product version if needed. if ( ( result = String ( ( guess . label && ! RegExp ( pattern , 'i' ) . test ( guess . label ) ) ? guess . label : result ) . split ( '/' ) ) [ 1 ] && ! / [\d.]+ / . test ( result [ 0 ] ) ) { result [ 0 ] += ' ' + result [ 1 ] ; } // Correct character case and cleanup string. guess = guess . label || guess ; result = format ( result [ 0 ] . replace ( RegExp ( pattern , 'i' ) , guess ) . replace ( RegExp ( '; *(?:' + guess + '[_-])?' , 'i' ) , ' ' ) . replace ( RegExp ( '(' + guess + ')[-_.]?(\\w)' , 'i' ) , '$1 $2' ) ) ; } return result ; } ) ; }
Picks the product name from an array of guesses.

@private
@param {Array} guesses An array of guesses.
@returns {null|string} The detected product name.
Picks the product name from an array of guesses .