export default class Utils {
+ import { BROWSER_ALIASES_MAP } from './constants.js';
+
+export default class Utils {
/**
* Get first matched item for a string
* @param {RegExp} regexp
@@ -230,6 +232,19 @@
}
return result;
}
+
+ /**
+ * Get short version/alias for a browser name
+ *
+ * @example
+ * getBrowserAlias('Microsoft Edge') // edge
+ *
+ * @param {string} browserName
+ * @return {string}
+ */
+ static getBrowserAlias(browserName) {
+ return BROWSER_ALIASES_MAP[browserName];
+ }
}
diff --git a/docs/Parser.html b/docs/Parser.html index cae36d6..7f0c240 100644 --- a/docs/Parser.html +++ b/docs/Parser.html @@ -26,7 +26,7 @@
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 a3c551b..005f8b9 100644 --- a/docs/bowser.js.html +++ b/docs/bowser.js.html @@ -26,7 +26,7 @@
diff --git a/docs/global.html b/docs/global.html index 6b7e103..73ac0ef 100644 --- a/docs/global.html +++ b/docs/global.html @@ -26,7 +26,7 @@
getBrowserAlias(browserName) → {string}
+ + + + + + +-
+
+
+
- Source: +
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Get short version/alias for a browser name
+Example
+ +getBrowserAlias('Microsoft Edge') // edge
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
browserName |
+
+
+ + + +string + + + + | + + + + + ++ |
Returns:
+ + + + +-
+
- + Type + +
- + +string + + + +
getFirstMatch(regexp, ua) → {Array|Object|*|boolean|string}
@@ -308,7 +464,7 @@"iPhone"
or "Kindle Fire HD 7"
diff --git a/docs/index.html b/docs/index.html
index 6a8be54..71f986f 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -26,7 +26,7 @@
Settings for any particular OS or platform has more priority and redefines settings of standalone browsers. Thus, you can define OS or platform specific rules and they will have more priority in the end.
More of API and possibilities you will find in the docs
folder.
Similar Projects
-
+
- Kong - A C# port of Bowser.
Browser names for .satisfies()
By default you are supposed to use the full browser name for .satisfies
.
+But, there's a short way to define a browser using short aliases. The full
+list of aliases can be found in the file.
Similar Projects
License
Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
+License
Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
@@ -154,7 +157,7 @@ Thus, you can define OS or platform specific rules and they will have more priordiff --git a/docs/parser.js.html b/docs/parser.js.html index ef5bcc6..9f54378 100644 --- a/docs/parser.js.html +++ b/docs/parser.js.html @@ -26,7 +26,7 @@
diff --git a/docs/utils.js.html b/docs/utils.js.html index 4e1bdcb..184707c 100644 --- a/docs/utils.js.html +++ b/docs/utils.js.html @@ -26,7 +26,7 @@