From 91ac5e2018eeb2ea04f442428901e4fdb88060f6 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Sun, 14 Apr 2019 13:45:57 +0300 Subject: [PATCH] Update docs --- docs/Bowser.html | 4 +- docs/Parser.html | 210 ++++++++++++++++++++++++++++++++++++++++++-- docs/bowser.js.html | 4 +- docs/global.html | 4 +- docs/index.html | 4 +- docs/parser.js.html | 23 +++-- docs/utils.js.html | 4 +- 7 files changed, 228 insertions(+), 25 deletions(-) diff --git a/docs/Bowser.html b/docs/Bowser.html index 57ecfa7..ef9f7b1 100644 --- a/docs/Bowser.html +++ b/docs/Bowser.html @@ -26,7 +26,7 @@
@@ -572,7 +572,7 @@ const result = parser.getResult();
- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.
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"isBrowser(browserName, includingAliasopt) → {boolean} + + + + + + +
+ + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Check if the browser name equals the passed string

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
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
Source:
@@ -2793,7 +2989,7 @@ Returns undefined when the browser is no described in the checkTree
- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.
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;
- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.
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"
- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.
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.


- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.
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;
- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.
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 {
- Documentation generated by JSDoc 3.5.5 on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Sun Apr 14 2019 13:45:42 GMT+0300 (EEST) using the docdash theme.