function versionOf_(browser) {
  let versionParts;
  // Silk currently does not identify itself in its userAgentData.brands array,
  // so if checking its version, always fall back to the user agent string.
  if (useUserAgentDataBrand() && browser !== Brand.SILK) {
    const data = util.getUserAgentData();
    const matchingBrand = data.brands.find(({brand}) => brand === browser);
    if (!matchingBrand || !matchingBrand.version) {
      return NaN;
    }
    versionParts = matchingBrand.version.split('.');
  } else {
    const fullVersion = getFullVersionFromUserAgentString(browser);
    if (fullVersion === '') {
      return NaN;
    }
    versionParts = fullVersion.split('.');
  }
  if (versionParts.length === 0) {
    return NaN;
  }
  const majorVersion = versionParts[0];
  return Number(majorVersion);  // Returns NaN if it is not parseable.
}
Returns the major version of the given browser brand, or NaN if the current
browser is not the given brand.
Note that the major version number may be different depending on which
browser is specified. The returned value can be used to make browser version
comparisons using comparison operators.
@private
@param {!AllBrandsInternal} browser The brand whose version should be
    returned.
@return {number} The major version number associated with the current
browser under the given brand, or NaN if the current browser doesn't match
the given brand.