Returns:
diff --git a/docs/Parser.html b/docs/Parser.html index 7f0c240c..15311e3d 100644 --- a/docs/Parser.html +++ b/docs/Parser.html @@ -26,7 +26,7 @@
@@ -1670,7 +1670,7 @@ isSource:
isSource:
@@ -1810,6 +1810,202 @@ Returns:
+ isBrowser(browserName, includingAliasopt) → {boolean}
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Check if the browser name equals the passed string
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ browserName
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The string to compare with the browser name
+
+
+
+
+
+
+ includingAlias
+
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ The flag showing whether alias will be included into comparison
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+ -
+ Type
+
+ -
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
parse()
@@ -2371,11 +2567,11 @@ satisfiesExample
const browser = new Bowser(UA);
-if (browser.check({chrome: '>118.01.1322' }))
+if (browser.satisfies({chrome: '>118.01.1322' }))
// or with os
-if (browser.check({windows: { chrome: '>118.01.1322' } }))
+if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
// or with platforms
-if (browser.check({desktop: { chrome: '>118.01.1322' } }))
+if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
@@ -2488,7 +2684,7 @@ someSource:
@@ -2793,7 +2989,7 @@ Returns:
diff --git a/docs/bowser.js.html b/docs/bowser.js.html
index 005f8b96..92479e14 100644
--- a/docs/bowser.js.html
+++ b/docs/bowser.js.html
@@ -26,7 +26,7 @@
@@ -105,7 +105,7 @@ bowser.js
diff --git a/docs/global.html b/docs/global.html
index 73ac0ef7..63340cb8 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -26,7 +26,7 @@
@@ -1995,7 +1995,7 @@ Properties
diff --git a/docs/index.html b/docs/index.html
index 71f986f3..df0ec082 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -26,7 +26,7 @@
@@ -157,7 +157,7 @@ License
Licensed as MIT. All rights not explicitly granted in the MIT
diff --git a/docs/parser.js.html b/docs/parser.js.html
index 9f54378a..ab43e3eb 100644
--- a/docs/parser.js.html
+++ b/docs/parser.js.html
@@ -26,7 +26,7 @@
@@ -386,11 +386,11 @@ parser.js
*
* @example
* const browser = new Bowser(UA);
- * if (browser.check({chrome: '>118.01.1322' }))
+ * if (browser.satisfies({chrome: '>118.01.1322' }))
* // or with os
- * if (browser.check({windows: { chrome: '>118.01.1322' } }))
+ * if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
* // or with platforms
- * if (browser.check({desktop: { chrome: '>118.01.1322' } }))
+ * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
*/
satisfies(checkTree) {
const platformsAndOSes = {};
@@ -445,12 +445,19 @@ parser.js
return undefined;
}
- isBrowser(browserName, loosely = false) {
+ /**
+ * Check if the browser name equals the passed string
+ * @param browserName The string to compare with the browser name
+ * @param [includingAlias=false] The flag showing whether alias will be included into comparison
+ * @returns {boolean}
+ */
+ isBrowser(browserName, includingAlias = false) {
const defaultBrowserName = this.getBrowserName();
const possibleNames = [defaultBrowserName.toLowerCase()];
+ const alias = Utils.getBrowserAlias(defaultBrowserName);
- if (loosely) {
- possibleNames.push(Utils.getBrowserAlias(defaultBrowserName).toLowerCase());
+ if (includingAlias && typeof alias !== 'undefined') {
+ possibleNames.push(alias.toLowerCase());
}
return possibleNames.indexOf(browserName.toLowerCase()) !== -1;
@@ -539,7 +546,7 @@ parser.js
diff --git a/docs/utils.js.html b/docs/utils.js.html
index 184707c3..c1102e46 100644
--- a/docs/utils.js.html
+++ b/docs/utils.js.html
@@ -26,7 +26,7 @@
@@ -260,7 +260,7 @@ utils.js
Check if the browser name equals the passed string
+browserName
The string to compare with the browser name
includingAlias
+ + + + + +
false
+
+ The flag showing whether alias will be included into comparison
const browser = new Bowser(UA);
-if (browser.check({chrome: '>118.01.1322' }))
+if (browser.satisfies({chrome: '>118.01.1322' }))
// or with os
-if (browser.check({windows: { chrome: '>118.01.1322' } }))
+if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
// or with platforms
-if (browser.check({desktop: { chrome: '>118.01.1322' } }))
+if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
@@ -2488,7 +2684,7 @@ someSource:
@@ -2793,7 +2989,7 @@ Returns:
diff --git a/docs/bowser.js.html b/docs/bowser.js.html
index 005f8b96..92479e14 100644
--- a/docs/bowser.js.html
+++ b/docs/bowser.js.html
@@ -26,7 +26,7 @@
@@ -105,7 +105,7 @@ bowser.js
diff --git a/docs/global.html b/docs/global.html
index 73ac0ef7..63340cb8 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -26,7 +26,7 @@
@@ -1995,7 +1995,7 @@ Properties
diff --git a/docs/index.html b/docs/index.html
index 71f986f3..df0ec082 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -26,7 +26,7 @@
@@ -157,7 +157,7 @@ License
Licensed as MIT. All rights not explicitly granted in the MIT
diff --git a/docs/parser.js.html b/docs/parser.js.html
index 9f54378a..ab43e3eb 100644
--- a/docs/parser.js.html
+++ b/docs/parser.js.html
@@ -26,7 +26,7 @@
@@ -386,11 +386,11 @@ parser.js
*
* @example
* const browser = new Bowser(UA);
- * if (browser.check({chrome: '>118.01.1322' }))
+ * if (browser.satisfies({chrome: '>118.01.1322' }))
* // or with os
- * if (browser.check({windows: { chrome: '>118.01.1322' } }))
+ * if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
* // or with platforms
- * if (browser.check({desktop: { chrome: '>118.01.1322' } }))
+ * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
*/
satisfies(checkTree) {
const platformsAndOSes = {};
@@ -445,12 +445,19 @@ parser.js
return undefined;
}
- isBrowser(browserName, loosely = false) {
+ /**
+ * Check if the browser name equals the passed string
+ * @param browserName The string to compare with the browser name
+ * @param [includingAlias=false] The flag showing whether alias will be included into comparison
+ * @returns {boolean}
+ */
+ isBrowser(browserName, includingAlias = false) {
const defaultBrowserName = this.getBrowserName();
const possibleNames = [defaultBrowserName.toLowerCase()];
+ const alias = Utils.getBrowserAlias(defaultBrowserName);
- if (loosely) {
- possibleNames.push(Utils.getBrowserAlias(defaultBrowserName).toLowerCase());
+ if (includingAlias && typeof alias !== 'undefined') {
+ possibleNames.push(alias.toLowerCase());
}
return possibleNames.indexOf(browserName.toLowerCase()) !== -1;
@@ -539,7 +546,7 @@ parser.js
diff --git a/docs/utils.js.html b/docs/utils.js.html
index 184707c3..c1102e46 100644
--- a/docs/utils.js.html
+++ b/docs/utils.js.html
@@ -26,7 +26,7 @@
@@ -260,7 +260,7 @@ utils.js
bowser.js
diff --git a/docs/global.html b/docs/global.html index 73ac0ef7..63340cb8 100644 --- a/docs/global.html +++ b/docs/global.html @@ -26,7 +26,7 @@
@@ -1995,7 +1995,7 @@
diff --git a/docs/index.html b/docs/index.html index 71f986f3..df0ec082 100644 --- a/docs/index.html +++ b/docs/index.html @@ -26,7 +26,7 @@
Properties
diff --git a/docs/index.html b/docs/index.html index 71f986f3..df0ec082 100644 --- a/docs/index.html +++ b/docs/index.html @@ -26,7 +26,7 @@
@@ -157,7 +157,7 @@
License
Licensed as MIT. All rights not explicitly granted in the MIT
diff --git a/docs/parser.js.html b/docs/parser.js.html
index 9f54378a..ab43e3eb 100644
--- a/docs/parser.js.html
+++ b/docs/parser.js.html
@@ -26,7 +26,7 @@
@@ -386,11 +386,11 @@
diff --git a/docs/utils.js.html b/docs/utils.js.html index 184707c3..c1102e46 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -26,7 +26,7 @@
parser.js
* * @example * const browser = new Bowser(UA); - * if (browser.check({chrome: '>118.01.1322' })) + * if (browser.satisfies({chrome: '>118.01.1322' })) * // or with os - * if (browser.check({windows: { chrome: '>118.01.1322' } })) + * if (browser.satisfies({windows: { chrome: '>118.01.1322' } })) * // or with platforms - * if (browser.check({desktop: { chrome: '>118.01.1322' } })) + * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } })) */ satisfies(checkTree) { const platformsAndOSes = {}; @@ -445,12 +445,19 @@parser.js
return undefined; } - isBrowser(browserName, loosely = false) { + /** + * Check if the browser name equals the passed string + * @param browserName The string to compare with the browser name + * @param [includingAlias=false] The flag showing whether alias will be included into comparison + * @returns {boolean} + */ + isBrowser(browserName, includingAlias = false) { const defaultBrowserName = this.getBrowserName(); const possibleNames = [defaultBrowserName.toLowerCase()]; + const alias = Utils.getBrowserAlias(defaultBrowserName); - if (loosely) { - possibleNames.push(Utils.getBrowserAlias(defaultBrowserName).toLowerCase()); + if (includingAlias && typeof alias !== 'undefined') { + possibleNames.push(alias.toLowerCase()); } return possibleNames.indexOf(browserName.toLowerCase()) !== -1; @@ -539,7 +546,7 @@parser.js
diff --git a/docs/utils.js.html b/docs/utils.js.html index 184707c3..c1102e46 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -26,7 +26,7 @@
@@ -260,7 +260,7 @@