Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
RELNOTES: Make deprecated goog.labs.userAgent.browser.versionOf a pri…
Browse files Browse the repository at this point in the history
…vate function.

PiperOrigin-RevId: 447997577
Change-Id: Ie33c0d498ca1c991c8d1985e707fb753a4bbe50b
  • Loading branch information
Closure Team authored and copybara-github committed May 11, 2022
1 parent 5b346c9 commit 54f139f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions closure/goog/labs/useragent/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,13 +508,13 @@ function getFullVersionFromUserAgentString(browser) {
* 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.
* @deprecated Use isAtLeast or isAtMost instead.
* @private
* @param {!Brand} 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.
*/
function versionOf(browser) {
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.
Expand All @@ -538,7 +538,6 @@ function versionOf(browser) {
const majorVersion = versionParts[0];
return Number(majorVersion); // Returns NaN if it is not parseable.
}
exports.versionOf = versionOf;

/**
* Returns true if the current browser matches the given brand and is at least
Expand All @@ -554,7 +553,7 @@ function isAtLeast(brand, majorVersion) {
googAsserts.assert(
Math.floor(majorVersion) === majorVersion,
'Major version must be an integer');
return versionOf(brand) >= majorVersion;
return versionOf_(brand) >= majorVersion;
}
exports.isAtLeast = isAtLeast;

Expand All @@ -572,7 +571,7 @@ function isAtMost(brand, majorVersion) {
googAsserts.assert(
Math.floor(majorVersion) === majorVersion,
'Major version must be an integer');
return versionOf(brand) <= majorVersion;
return versionOf_(brand) <= majorVersion;
}
exports.isAtMost = isAtMost;

Expand Down
2 changes: 1 addition & 1 deletion closure/goog/labs/useragent/highentropy/highentropydata.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let fullVersionListAvailable = false;
* TODO(user): When fullVersionList is added, move hasFullVersionList()
* to browser.js, and inline the browser version check. For example, if it is
* implemented in Chromium 101, have hasFullVersionList simply return
* `browser.versionOf(CHROMIUM) >= 101`.
* `browser.isAtLeast(browser.Brand.CHROMIUM, 101)`.
* @return {boolean}
*/
function hasFullVersionList() {
Expand Down

0 comments on commit 54f139f

Please sign in to comment.