diff --git a/docs/Parser.html b/docs/Parser.html index 7f0c240..15311e3 100644 --- a/docs/Parser.html +++ b/docs/Parser.html @@ -26,7 +26,7 @@
@@ -1670,7 +1670,7 @@ like Parser#parseBrowser or Source:
@@ -1810,6 +1810,202 @@ the OS called "anything" or the platform called "anything"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Source:
@@ -2793,7 +2989,7 @@ Returns
diff --git a/docs/bowser.js.html b/docs/bowser.js.html index 005f8b9..92479e1 100644 --- a/docs/bowser.js.html +++ b/docs/bowser.js.html @@ -26,7 +26,7 @@
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 @@ the OS called "anything" or the platform called "anything"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' } }))
@@ -2488,7 +2684,7 @@ Returns undefined
when the browser is no described in the checkTree
undefined
when the browser is no described in the checkTree
diff --git a/docs/bowser.js.html b/docs/bowser.js.html index 005f8b9..92479e1 100644 --- a/docs/bowser.js.html +++ b/docs/bowser.js.html @@ -26,7 +26,7 @@
@@ -105,7 +105,7 @@ export default Bowser;
diff --git a/docs/global.html b/docs/global.html index 73ac0ef..63340cb 100644 --- a/docs/global.html +++ b/docs/global.html @@ -26,7 +26,7 @@
diff --git a/docs/global.html b/docs/global.html index 73ac0ef..63340cb 100644 --- a/docs/global.html +++ b/docs/global.html @@ -26,7 +26,7 @@
@@ -1995,7 +1995,7 @@ like
"iPhone"
or "Kindle Fire HD 7"
diff --git a/docs/index.html b/docs/index.html
index 71f986f..df0ec08 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -26,7 +26,7 @@
@@ -157,7 +157,7 @@ list of aliases can be found in the file.
diff --git a/docs/parser.js.html b/docs/parser.js.html index 9f54378..ab43e3e 100644 --- a/docs/parser.js.html +++ b/docs/parser.js.html @@ -26,7 +26,7 @@
diff --git a/docs/parser.js.html b/docs/parser.js.html index 9f54378..ab43e3e 100644 --- a/docs/parser.js.html +++ b/docs/parser.js.html @@ -26,7 +26,7 @@
@@ -386,11 +386,11 @@ class Parser {
*
* @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 @@ class Parser {
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 @@ export default Parser;
diff --git a/docs/utils.js.html b/docs/utils.js.html index 184707c..c1102e4 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -26,7 +26,7 @@
diff --git a/docs/utils.js.html b/docs/utils.js.html index 184707c..c1102e4 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -26,7 +26,7 @@
@@ -260,7 +260,7 @@ export default class Utils {