1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Merge tag 'release/2.5.0'

2.5.0 release/2.5.0
This commit is contained in:
Denis Demchenko 2019-07-16 22:28:15 +03:00
commit b16fc7135f
16 changed files with 810 additions and 212 deletions

View File

@ -1,5 +1,11 @@
# Bowser Changelog # Bowser Changelog
### 2.5.0 (July 16, 2019)
- [ADD] Add constant output so that users can quickly get all types (#325)
- [FIX] Add support for Roku OS (#332)
- [FIX] Update devDependencies
- [FIX] Fix docs, README and added funding information
### 2.4.0 (May 3, 2019) ### 2.4.0 (May 3, 2019)
- [FIX] Update regexp for generic browsers (#310) - [FIX] Update regexp for generic browsers (#310)
- [FIX] Fix issues with module.exports (#318) - [FIX] Fix issues with module.exports (#318)

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -47,105 +48,17 @@
Bowser Bowser
</h2> </h2>
<div class="class-description"><p>Bowser class. <div class="class-description"><p>Bowser is a static object, that provides an API to the Parsers</p></div>
Keep it simple as much as it can be.
It's supposed to work with collections of <a href="Parser.html">Parser</a> instances
rather then solve one-instance problems.
All the one-instance stuff is located in Parser class.</p></div>
</header> </header>
<article> <article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Bowser"><span class="type-signature"></span>new Bowser<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="bowser.js.html">bowser.js</a>, <a href="bowser.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
</div>
@ -177,7 +90,7 @@ All the one-instance stuff is located in Parser class.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="bowser.js.html">bowser.js</a>, <a href="bowser.js.html#line29">line 29</a> <a href="bowser.js.html">bowser.js</a>, <a href="bowser.js.html#line51">line 51</a>
</li></ul></dd> </li></ul></dd>
@ -217,7 +130,7 @@ All the one-instance stuff is located in Parser class.</p></div>
<div class="description"> <div class="description">
<p>Creates a module:parser:Parser instance</p> <p>Creates a <a href="Parser.html">Parser</a> instance</p>
</div> </div>
@ -332,7 +245,8 @@ const result = parser.getResult();</code></pre>
</td> </td>
<td class="description last"><p>same as skipParsing for <a href="Parser.html">Parser</a></p></td> <td class="description last"><p>Will make the Parser postpone parsing until you ask it
explicitly. Same as <code>skipParsing</code> for <a href="Parser.html">Parser</a>.</p></td>
</tr> </tr>
@ -350,6 +264,8 @@ const result = parser.getResult();</code></pre>
<h5>Throws:</h5> <h5>Throws:</h5>
@ -368,7 +284,7 @@ const result = parser.getResult();</code></pre>
</dt> </dt>
<dd> <dd>
<span class="param-type">Error</span> <span class="param-type"><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></span>
</dd> </dd>
@ -406,6 +322,7 @@ const result = parser.getResult();</code></pre>
<h4 class="name" id=".parse"><span class="type-signature">(static) </span>parse<span class="signature">(UA)</span><span class="type-signature"> &rarr; {<a href="global.html#ParsedResult">ParsedResult</a>}</span></h4> <h4 class="name" id=".parse"><span class="type-signature">(static) </span>parse<span class="signature">(UA)</span><span class="type-signature"> &rarr; {<a href="global.html#ParsedResult">ParsedResult</a>}</span></h4>
@ -418,7 +335,7 @@ const result = parser.getResult();</code></pre>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="bowser.js.html">bowser.js</a>, <a href="bowser.js.html#line45">line 45</a> <a href="bowser.js.html">bowser.js</a>, <a href="bowser.js.html#line67">line 67</a>
</li></ul></dd> </li></ul></dd>
@ -532,6 +449,8 @@ const result = parser.getResult();</code></pre>
<h5>Returns:</h5> <h5>Returns:</h5>
@ -558,6 +477,7 @@ const result = parser.getResult();</code></pre>
</article> </article>
</section> </section>
@ -572,12 +492,14 @@ const result = parser.getResult();</code></pre>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

View File

@ -0,0 +1,234 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>BowserUAIsNotAStringError - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">BowserUAIsNotAStringError</h1>
<section>
<header>
<h2>
BowserUAIsNotAStringError
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="BowserUAIsNotAStringError"><span class="type-signature"></span>new BowserUAIsNotAStringError<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="bowser.js.html">bowser.js</a>, <a href="bowser.js.html#line20">line 20</a>
</li></ul></dd>
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
</div>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -74,7 +75,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line10">line 10</a> <a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line23">line 23</a>
</li></ul></dd> </li></ul></dd>
@ -248,6 +249,9 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
</div> </div>
@ -264,6 +268,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h3 class="subsection-title">Methods</h3> <h3 class="subsection-title">Methods</h3>
@ -345,6 +351,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -373,6 +381,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getBrowserName"><span class="type-signature"></span>getBrowserName<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <h4 class="name" id="getBrowserName"><span class="type-signature"></span>getBrowserName<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
@ -447,6 +456,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -479,6 +490,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getBrowserVersion"><span class="type-signature"></span>getBrowserVersion<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <h4 class="name" id="getBrowserVersion"><span class="type-signature"></span>getBrowserVersion<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
@ -553,6 +565,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -585,6 +599,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getEngine"><span class="type-signature"></span>getEngine<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id="getEngine"><span class="type-signature"></span>getEngine<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
@ -659,6 +674,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -687,6 +704,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getEngineName"><span class="type-signature"></span>getEngineName<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <h4 class="name" id="getEngineName"><span class="type-signature"></span>getEngineName<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
@ -761,6 +779,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -793,6 +813,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getOS"><span class="type-signature"></span>getOS<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id="getOS"><span class="type-signature"></span>getOS<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
@ -879,6 +900,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h5>Returns:</h5> <h5>Returns:</h5>
@ -904,6 +927,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getOSName"><span class="type-signature"></span>getOSName<span class="signature">(toLowerCase<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {String}</span></h4> <h4 class="name" id="getOSName"><span class="type-signature"></span>getOSName<span class="signature">(toLowerCase<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
@ -1042,6 +1066,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h5>Returns:</h5> <h5>Returns:</h5>
@ -1071,6 +1097,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getOSVersion"><span class="type-signature"></span>getOSVersion<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <h4 class="name" id="getOSVersion"><span class="type-signature"></span>getOSVersion<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
@ -1145,6 +1172,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -1177,6 +1206,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getPlatform"><span class="type-signature"></span>getPlatform<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id="getPlatform"><span class="type-signature"></span>getPlatform<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
@ -1251,6 +1281,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -1279,6 +1311,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getPlatformType"><span class="type-signature"></span>getPlatformType<span class="signature">(toLowerCase<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <h4 class="name" id="getPlatformType"><span class="type-signature"></span>getPlatformType<span class="signature">(toLowerCase<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
@ -1425,6 +1458,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h5>Returns:</h5> <h5>Returns:</h5>
@ -1450,6 +1485,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getResult"><span class="type-signature"></span>getResult<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#ParsedResult">ParsedResult</a>}</span></h4> <h4 class="name" id="getResult"><span class="type-signature"></span>getResult<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#ParsedResult">ParsedResult</a>}</span></h4>
@ -1524,6 +1560,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -1552,6 +1590,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="getUA"><span class="type-signature"></span>getUA<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <h4 class="name" id="getUA"><span class="type-signature"></span>getUA<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
@ -1626,6 +1665,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
@ -1658,6 +1699,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<h4 class="name" id="is"><span class="type-signature"></span>is<span class="signature">(anything)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <h4 class="name" id="is"><span class="type-signature"></span>is<span class="signature">(anything)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
@ -1670,7 +1712,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line477">line 477</a> <a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line476">line 476</a>
</li></ul></dd> </li></ul></dd>
@ -1785,6 +1827,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h5>Returns:</h5> <h5>Returns:</h5>
@ -1810,6 +1854,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="isBrowser"><span class="type-signature"></span>isBrowser<span class="signature">(browserName, includingAlias<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <h4 class="name" id="isBrowser"><span class="type-signature"></span>isBrowser<span class="signature">(browserName, includingAlias<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
@ -1981,6 +2026,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h5>Returns:</h5> <h5>Returns:</h5>
@ -2006,6 +2053,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">()</span><span class="type-signature"></span></h4> <h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">()</span><span class="type-signature"></span></h4>
@ -2086,6 +2134,9 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
@ -2164,6 +2215,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
@ -2192,6 +2245,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="parseEngine"><span class="type-signature"></span>parseEngine<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id="parseEngine"><span class="type-signature"></span>parseEngine<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
@ -2266,6 +2320,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
@ -2294,6 +2350,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="parseOS"><span class="type-signature"></span>parseOS<span class="signature">()</span><span class="type-signature"> &rarr; {*|Object}</span></h4> <h4 class="name" id="parseOS"><span class="type-signature"></span>parseOS<span class="signature">()</span><span class="type-signature"> &rarr; {*|Object}</span></h4>
@ -2368,6 +2425,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
@ -2399,6 +2458,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="parsePlatform"><span class="type-signature"></span>parsePlatform<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id="parsePlatform"><span class="type-signature"></span>parsePlatform<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
@ -2473,6 +2533,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
@ -2501,6 +2563,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="satisfies"><span class="type-signature"></span>satisfies<span class="signature">(checkTree)</span><span class="type-signature"> &rarr; {Boolean|undefined}</span></h4> <h4 class="name" id="satisfies"><span class="type-signature"></span>satisfies<span class="signature">(checkTree)</span><span class="type-signature"> &rarr; {Boolean|undefined}</span></h4>
@ -2639,6 +2702,8 @@ and should have browsers specs on the bottom-laying layer</p></td>
<h5>Returns:</h5> <h5>Returns:</h5>
@ -2672,6 +2737,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<h4 class="name" id="some"><span class="type-signature"></span>some<span class="signature">(anythings)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <h4 class="name" id="some"><span class="type-signature"></span>some<span class="signature">(anythings)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
@ -2684,7 +2750,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line486">line 486</a> <a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line485">line 485</a>
</li></ul></dd> </li></ul></dd>
@ -2798,6 +2864,8 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<h5>Returns:</h5> <h5>Returns:</h5>
@ -2823,6 +2891,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<h4 class="name" id="test"><span class="type-signature"></span>test<span class="signature">(regex)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <h4 class="name" id="test"><span class="type-signature"></span>test<span class="signature">(regex)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
@ -2949,6 +3018,8 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<h5>Returns:</h5> <h5>Returns:</h5>
@ -2975,6 +3046,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
</article> </article>
</section> </section>
@ -2989,12 +3061,14 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -45,9 +46,26 @@
* Bowser - a browser detector * Bowser - a browser detector
* https://github.com/lancedikson/bowser * https://github.com/lancedikson/bowser
* MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Dustin Diaz 2012-2015
* MIT License | (c) Denis Demchenko 2015-2017 * MIT License | (c) Denis Demchenko 2015-2019
*/ */
import Parser from './parser.js'; import Parser from './parser.js';
import {
BROWSER_MAP,
ENGINE_MAP,
OS_MAP,
PLATFORMS_MAP,
} from './constants.js';
/**
* @class
* @property name
*/
class BowserUAIsNotAStringError extends Error {
constructor(message) {
super(message);
this.name = 'BowserUAIsNotAStringError';
}
}
/** /**
* Bowser class. * Bowser class.
@ -55,15 +73,20 @@ import Parser from './parser.js';
* It's supposed to work with collections of {@link Parser} instances * It's supposed to work with collections of {@link Parser} instances
* rather then solve one-instance problems. * rather then solve one-instance problems.
* All the one-instance stuff is located in Parser class. * All the one-instance stuff is located in Parser class.
*
* @class
* @classdesc Bowser is a static object, that provides an API to the Parsers
* @hideconstructor
*/ */
class Bowser { class Bowser {
/** /**
* Creates a {@link module:parser:Parser} instance * Creates a {@link Parser} instance
* *
* @param {String} UA UserAgent string * @param {String} UA UserAgent string
* @param {Boolean} [skipParsing=false] same as skipParsing for {@link Parser} * @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it
* explicitly. Same as `skipParsing` for {@link Parser}.
* @returns {Parser} * @returns {Parser}
* @throws {Error} when UA is not a String * @throws {BowserUAIsNotAStringError} when UA is not a String
* *
* @example * @example
* const parser = Bowser.getParser(window.navigator.userAgent); * const parser = Bowser.getParser(window.navigator.userAgent);
@ -71,7 +94,7 @@ class Bowser {
*/ */
static getParser(UA, skipParsing = false) { static getParser(UA, skipParsing = false) {
if (typeof UA !== 'string') { if (typeof UA !== 'string') {
throw new Error('UserAgent should be a string'); throw new BowserUAIsNotAStringError('UserAgent should be a string');
} }
return new Parser(UA, skipParsing); return new Parser(UA, skipParsing);
} }
@ -88,6 +111,22 @@ class Bowser {
static parse(UA) { static parse(UA) {
return (new Parser(UA)).getResult(); return (new Parser(UA)).getResult();
} }
static get BROWSER_MAP() {
return BROWSER_MAP;
}
static get ENGINE_MAP() {
return ENGINE_MAP;
}
static get OS_MAP() {
return OS_MAP;
}
static get PLATFORMS_MAP() {
return PLATFORMS_MAP;
}
} }
export default Bowser; export default Bowser;
@ -105,12 +144,14 @@ export default Bowser;
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -114,6 +115,8 @@
<h3 class="subsection-title">Methods</h3> <h3 class="subsection-title">Methods</h3>
@ -174,21 +177,21 @@
<div class="description"> <div class="description">
<p>Get Android version name <p>Get Android version name
1.5 - Cupcake 1.5 - Cupcake
1.6 - Donut 1.6 - Donut
2.0 - Eclair 2.0 - Eclair
2.1 - Eclair 2.1 - Eclair
2.2 - Froyo 2.2 - Froyo
2.x - Gingerbread 2.x - Gingerbread
3.x - Honeycomb 3.x - Honeycomb
4.0 - Ice Cream Sandwich 4.0 - Ice Cream Sandwich
4.1 - Jelly Bean 4.1 - Jelly Bean
4.4 - KitKat 4.4 - KitKat
5.x - Lollipop 5.x - Lollipop
6.x - Marshmallow 6.x - Marshmallow
7.x - Nougat 7.x - Nougat
8.x - Oreo 8.x - Oreo
9.x - ?</p> 9.x - ?</p>
</div> </div>
@ -267,6 +270,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -296,6 +301,7 @@
<h4 class="name" id="getBrowserAlias"><span class="type-signature"></span>getBrowserAlias<span class="signature">(browserName)</span><span class="type-signature"> &rarr; {string}</span></h4> <h4 class="name" id="getBrowserAlias"><span class="type-signature"></span>getBrowserAlias<span class="signature">(browserName)</span><span class="type-signature"> &rarr; {string}</span></h4>
@ -427,6 +433,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -452,6 +460,166 @@
<h4 class="name" id="getBrowserTypeByAlias"><span class="type-signature"></span>getBrowserTypeByAlias<span class="signature">(browserName)</span><span class="type-signature"> &rarr; {string}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line215">line 215</a>
</li></ul></dd>
</dl>
<div class="description">
<p>Get short version/alias for a browser name</p>
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>getBrowserAlias('edge') // Microsoft Edge</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>browserName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getFirstMatch"><span class="type-signature"></span>getFirstMatch<span class="signature">(regexp, ua)</span><span class="type-signature"> &rarr; {Array|Object|*|boolean|string}</span></h4> <h4 class="name" id="getFirstMatch"><span class="type-signature"></span>getFirstMatch<span class="signature">(regexp, ua)</span><span class="type-signature"> &rarr; {Array|Object|*|boolean|string}</span></h4>
@ -601,6 +769,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -638,6 +808,7 @@
<h4 class="name" id="getSecondMatch"><span class="type-signature"></span>getSecondMatch<span class="signature">(regexp, ua)</span><span class="type-signature"> &rarr; {Array|Object|*|boolean|string}</span></h4> <h4 class="name" id="getSecondMatch"><span class="type-signature"></span>getSecondMatch<span class="signature">(regexp, ua)</span><span class="type-signature"> &rarr; {Array|Object|*|boolean|string}</span></h4>
@ -782,6 +953,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -819,6 +992,7 @@
<h4 class="name" id="getVersionPrecision"><span class="type-signature"></span>getVersionPrecision<span class="signature">(version)</span><span class="type-signature"> &rarr; {number}</span></h4> <h4 class="name" id="getVersionPrecision"><span class="type-signature"></span>getVersionPrecision<span class="signature">(version)</span><span class="type-signature"> &rarr; {number}</span></h4>
@ -950,6 +1124,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -975,6 +1151,7 @@
<h4 class="name" id="map"><span class="type-signature"></span>map<span class="signature">(arr, iterator)</span><span class="type-signature"> &rarr; {Array}</span></h4> <h4 class="name" id="map"><span class="type-signature"></span>map<span class="signature">(arr, iterator)</span><span class="type-signature"> &rarr; {Array}</span></h4>
@ -1124,6 +1301,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -1149,6 +1328,7 @@
<h4 class="name" id="matchAndReturnConst"><span class="type-signature"></span>matchAndReturnConst<span class="signature">(regexp, ua, _const)</span><span class="type-signature"> &rarr; {*}</span></h4> <h4 class="name" id="matchAndReturnConst"><span class="type-signature"></span>matchAndReturnConst<span class="signature">(regexp, ua, _const)</span><span class="type-signature"> &rarr; {*}</span></h4>
@ -1321,6 +1501,8 @@
<h5>Returns:</h5> <h5>Returns:</h5>
@ -1345,6 +1527,7 @@
<h3 class="subsection-title">Type Definitions</h3> <h3 class="subsection-title">Type Definitions</h3>
@ -1995,12 +2178,14 @@ like <code>&quot;iPhone&quot;</code> or <code>&quot;Kindle Fire HD 7&quot;</code
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -39,6 +40,12 @@
<section class="package">
<h3> </h3>
</section>
@ -50,32 +57,48 @@
<section class="readme"> <section class="readme">
<article><h2>Bowser</h2><p>A browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.</p> <article><h2>Bowser</h2>
<p><a href="https://travis-ci.org/lancedikson/bowser/"><img src="https://travis-ci.org/lancedikson/bowser.svg?branch=master" alt="Build Status"></a> <a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/lancedikson/bowser.svg" alt="Greenkeeper badge"></a><a href="https://coveralls.io/github/lancedikson/bowser?branch=master"><img src="https://coveralls.io/repos/github/lancedikson/bowser/badge.svg?branch=master" alt="Coverage Status"></a></p> <p>A small, fast and reach-API browser/platform/engine detector for both browser and node.</p>
<h1>Contents</h1><ul> <ul>
<li><strong>Small.</strong> Use plain ES5-version which is ~4.8kB gzipped.</li>
<li><strong>Optimized.</strong> Use only those parsers you need — it doesn't do useless work.</li>
<li><strong>Multi-platform.</strong> It's browser- and node-ready, so you can use it in any environment.</li>
</ul>
<p>Don't hesitate to support the project on Github or <a href="https://opencollective.com/bowser">OpenCollective</a> if you like it ❤️ Also, contributors are always welcome!</p>
<p><a href="https://travis-ci.org/lancedikson/bowser/"><img src="https://travis-ci.org/lancedikson/bowser.svg?branch=master" alt="Build Status"></a> <a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/lancedikson/bowser.svg" alt="Greenkeeper badge"></a> <a href="https://coveralls.io/github/lancedikson/bowser?branch=master"><img src="https://coveralls.io/repos/github/lancedikson/bowser/badge.svg?branch=master" alt="Coverage Status"></a></p>
<h1>Contents</h1>
<ul>
<li><a href="#overview">Overview</a></li> <li><a href="#overview">Overview</a></li>
<li><a href="#use-cases">Use cases</a></li> <li><a href="#use-cases">Use cases</a></li>
<li><a href="#advanced-usage">Advanced usage</a></li> <li><a href="#advanced-usage">Advanced usage</a></li>
<li><a href="#contributing">How can I help?</a></li> <li><a href="#contributing">How can I help?</a></li>
</ul> </ul>
<h1>Overview</h1><p>The library is made to help to detect what browser your user has and gives you a convenient API to filter the users somehow depending on their browsers.</p> <h1>Overview</h1>
<h3>⚠️ Version 2.0 breaking changes ⚠️</h3><p>Version 2.0 has drastically changed the API. All available methods are on the <a href="https://lancedikson.github.io/bowser/docs">docs page</a>.</p> <p>The library is made to help to detect what browser your user has and gives you a convenient API to filter the users somehow depending on their browsers.</p>
<h3>⚠️ Version 2.0 breaking changes ⚠️</h3>
<p>Version 2.0 has drastically changed the API. All available methods are on the <a href="https://lancedikson.github.io/bowser/docs">docs page</a>.</p>
<p><em>For legacy code, check out the <a href="https://github.com/lancedikson/bowser/tree/v1.x">1.x</a> branch and install it through <code>npm install bowser@1.9.4</code>.</em></p> <p><em>For legacy code, check out the <a href="https://github.com/lancedikson/bowser/tree/v1.x">1.x</a> branch and install it through <code>npm install bowser@1.9.4</code>.</em></p>
<h1>Use cases</h1><p>First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.</p> <h1>Use cases</h1>
<p>First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.</p>
<pre class="prettyprint source lang-javascript"><code>const Bowser = require(&quot;bowser&quot;); // CommonJS <pre class="prettyprint source lang-javascript"><code>const Bowser = require(&quot;bowser&quot;); // CommonJS
import * as Bowser from &quot;bowser&quot;; // TypeScript import * as Bowser from &quot;bowser&quot;; // TypeScript
import Bowser from &quot;bowser&quot;; // ES6 (and TypeScript with --esModuleInterop enabled)</code></pre><p>By default, the exported version is the <em>ES5 transpiled version</em>, which <strong>do not</strong> include any polyfills.</p> import Bowser from &quot;bowser&quot;; // ES6 (and TypeScript with --esModuleInterop enabled)
</code></pre>
<p>By default, the exported version is the <em>ES5 transpiled version</em>, which <strong>do not</strong> include any polyfills.</p>
<p>In case you don't use your own <code>babel-polyfill</code> you may need to have pre-built bundle with all needed polyfills. <p>In case you don't use your own <code>babel-polyfill</code> you may need to have pre-built bundle with all needed polyfills.
So, for you it's suitable to require bowser like this: <code>require('bowser/bundled')</code>. So, for you it's suitable to require bowser like this: <code>require('bowser/bundled')</code>.
As the result, you get a ES5 version of bowser with <code>babel-polyfill</code> bundled together.</p> As the result, you get a ES5 version of bowser with <code>babel-polyfill</code> bundled together.</p>
<p>You may need to use the source files, so they will be available in the package as well.</p> <p>You may need to use the source files, so they will be available in the package as well.</p>
<h2>Browser props detection</h2><p>Often we need to pick users' browser properties such as the name, the version, the rendering engine and so on. Here is an example how to do it with Bowser:</p> <h2>Browser props detection</h2>
<p>Often we need to pick users' browser properties such as the name, the version, the rendering engine and so on. Here is an example how to do it with Bowser:</p>
<pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent); <pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent);
console.log(`The current browser name is &quot;${browser.getBrowserName()}&quot;`); console.log(`The current browser name is &quot;${browser.getBrowserName()}&quot;`);
// The current browser name is &quot;Internet Explorer&quot;</code></pre><p>or</p> // The current browser name is &quot;Internet Explorer&quot;
</code></pre>
<p>or</p>
<pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent); <pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent);
console.log(browser.getBrowser()); console.log(browser.getBrowser());
@ -83,7 +106,9 @@ console.log(browser.getBrowser());
{ {
name: &quot;Internet Explorer&quot; name: &quot;Internet Explorer&quot;
version: &quot;11.0&quot; version: &quot;11.0&quot;
}</code></pre><p>or</p> }
</code></pre>
<p>or</p>
<pre class="prettyprint source lang-javascript"><code>console.log(Bowser.parse(window.navigator.userAgent)); <pre class="prettyprint source lang-javascript"><code>console.log(Bowser.parse(window.navigator.userAgent));
// outputs // outputs
@ -104,7 +129,10 @@ console.log(browser.getBrowser());
name: &quot;Trident&quot; name: &quot;Trident&quot;
version: &quot;7.0&quot; version: &quot;7.0&quot;
} }
}</code></pre><h2>Filtering browsers</h2><p>You could want to filter some particular browsers to provide any special support for them or make any workarounds. }
</code></pre>
<h2>Filtering browsers</h2>
<p>You could want to filter some particular browsers to provide any special support for them or make any workarounds.
It could look like this:</p> It could look like this:</p>
<pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent); <pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent);
const isValidBrowser = browser.satisfies({ const isValidBrowser = browser.satisfies({
@ -133,16 +161,21 @@ const isValidBrowser = browser.satisfies({
// and loose-equality operator // and loose-equality operator
chrome: &quot;~20&quot; // will match any 20.* sub-version chrome: &quot;~20&quot; // will match any 20.* sub-version
chrome: &quot;~20.1&quot; // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1) chrome: &quot;~20.1&quot; // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
});</code></pre><p>Settings for any particular OS or platform has more priority and redefines settings of standalone browsers. });
</code></pre>
<p>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.</p> Thus, you can define OS or platform specific rules and they will have more priority in the end.</p>
<p>More of API and possibilities you will find in the <code>docs</code> folder.</p> <p>More of API and possibilities you will find in the <code>docs</code> folder.</p>
<h3>Browser names for <code>.satisfies()</code></h3><p>By default you are supposed to use the full browser name for <code>.satisfies</code>. <h3>Browser names for <code>.satisfies()</code></h3>
<p>By default you are supposed to use the full browser name for <code>.satisfies</code>.
But, there's a short way to define a browser using short aliases. The full But, there's a short way to define a browser using short aliases. The full
list of aliases can be found in <a href="src/constants.js">the file</a>.</p> list of aliases can be found in <a href="src/constants.js">the file</a>.</p>
<h2>Similar Projects</h2><ul> <h2>Similar Projects</h2>
<ul>
<li><a href="https://github.com/BigBadBleuCheese/Kong">Kong</a> - A C# port of Bowser.</li> <li><a href="https://github.com/BigBadBleuCheese/Kong">Kong</a> - A C# port of Bowser.</li>
</ul> </ul>
<h2>License</h2><p>Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.</p></article> <h2>License</h2>
<p>Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.</p></article>
</section> </section>
@ -157,12 +190,14 @@ list of aliases can be found in <a href="src/constants.js">the file</a>.</p>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -452,15 +453,14 @@ class Parser {
* @returns {boolean} * @returns {boolean}
*/ */
isBrowser(browserName, includingAlias = false) { isBrowser(browserName, includingAlias = false) {
const defaultBrowserName = this.getBrowserName(); const defaultBrowserName = this.getBrowserName().toLowerCase();
const possibleNames = [defaultBrowserName.toLowerCase()]; let browserNameLower = browserName.toLowerCase();
const alias = Utils.getBrowserAlias(defaultBrowserName); const alias = Utils.getBrowserTypeByAlias(browserNameLower);
if (includingAlias &amp;&amp; typeof alias !== 'undefined') { if (includingAlias &amp;&amp; alias) {
possibleNames.push(alias.toLowerCase()); browserNameLower = alias.toLowerCase();
} }
return browserNameLower === defaultBrowserName;
return possibleNames.indexOf(browserName.toLowerCase()) !== -1;
} }
compareVersion(version) { compareVersion(version) {
@ -546,12 +546,14 @@ export default Parser;
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

View File

@ -1,11 +1,20 @@
function hideAllButCurrent(){ function hideAllButCurrent(){
//by default all submenut items are hidden //by default all submenut items are hidden
$("nav > ul > li > ul li").hide(); //but we need to rehide them for search
document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) {
parent.style.display = "none";
});
//only current page (if it exists) should be opened //only current page (if it exists) should be opened
var file = window.location.pathname.split("/").pop(); var file = window.location.pathname.split("/").pop().replace(/\.html/, '');
$("nav > ul > li > a[href^='"+file+"']").parent().find("> ul li").show(); document.querySelectorAll("nav > ul > li > a").forEach(function(parent) {
var href = parent.attributes.href.value.replace(/\.html/, '');
if (file === href) {
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
elem.style.display = "block";
});
}
});
} }
$( document ).ready(function() {
hideAllButCurrent(); hideAllButCurrent();
});

12
docs/scripts/nav.js Normal file
View File

@ -0,0 +1,12 @@
function scrollToNavItem() {
var path = window.location.href.split('/').pop().replace(/\.html/, '');
document.querySelectorAll('nav a').forEach(function(link) {
var href = link.attributes.href.value.replace(/\.html/, '');
if (path === href) {
link.scrollIntoView({block: 'center'});
return;
}
})
}
scrollToNavItem();

4
docs/scripts/polyfill.js Normal file
View File

@ -0,0 +1,4 @@
//IE Fix, src: https://www.reddit.com/r/programminghorror/comments/6abmcr/nodelist_lacks_foreach_in_internet_explorer/
if (typeof(NodeList.prototype.forEach)!==typeof(alert)){
NodeList.prototype.forEach=Array.prototype.forEach;
}

View File

@ -1,42 +1,83 @@
$( document ).ready(function() {
jQuery.expr[':'].Contains = function(a,i,m){
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
};
//on search
$("#nav-search").on("keyup", function(event) {
var search = $(this).val();
if (!search) {
//no search, show all results
$("nav > ul > li").show();
if(typeof hideAllButCurrent === "function"){ var searchAttr = 'data-search-mode';
//let's do what ever collapse wants to do function contains(a,m){
hideAllButCurrent(); return (a.textContent || a.innerText || "").toUpperCase().indexOf(m) !== -1;
} };
else{
//menu by default should be opened //on search
$("nav > ul > li > ul li").show(); document.getElementById("nav-search").addEventListener("keyup", function(event) {
} var search = this.value.toUpperCase();
}
else{ if (!search) {
//we are searching //no search, show all results
//show all parents document.documentElement.removeAttribute(searchAttr);
$("nav > ul > li").show();
//hide all results document.querySelectorAll("nav > ul > li:not(.level-hide)").forEach(function(elem) {
$("nav > ul > li > ul li").hide(); elem.style.display = "block";
//show results matching filter });
$("nav > ul > li > ul").find("a:Contains("+search+")").parent().show();
//hide parents without children if (typeof hideAllButCurrent === "function"){
$("nav > ul > li").each(function(){ //let's do what ever collapse wants to do
if($(this).find("a:Contains("+search+")").length == 0 && $(this).children("ul").length === 0){ hideAllButCurrent();
//has no child at all and does not contain text } else {
$(this).hide(); //menu by default should be opened
} document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
else if($(this).find("a:Contains("+search+")").length == 0 && $(this).find("ul").children(':visible').length == 0){ elem.style.display = "block";
//has no visible child and does not contain text
$(this).hide();
}
}); });
} }
}); } else {
//we are searching
document.documentElement.setAttribute(searchAttr, '');
//show all parents
document.querySelectorAll("nav > ul > li").forEach(function(elem) {
elem.style.display = "block";
});
//hide all results
document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
elem.style.display = "none";
});
//show results matching filter
document.querySelectorAll("nav > ul > li > ul a").forEach(function(elem) {
if (!contains(elem.parentNode, search)) {
return;
}
elem.parentNode.style.display = "block";
});
//hide parents without children
document.querySelectorAll("nav > ul > li").forEach(function(parent) {
var countSearchA = 0;
parent.querySelectorAll("a").forEach(function(elem) {
if (contains(elem, search)) {
countSearchA++;
}
});
var countUl = 0;
var countUlVisible = 0;
parent.querySelectorAll("ul").forEach(function(ulP) {
// count all elements that match the search
if (contains(ulP, search)) {
countUl++;
}
// count all visible elements
var children = ulP.children
for (i=0; i<children.length; i++) {
var elem = children[i];
if (elem.style.display != "none") {
countUlVisible++;
}
}
});
if (countSearchA == 0 && countUl === 0){
//has no child at all and does not contain text
parent.style.display = "none";
} else if(countSearchA == 0 && countUlVisible == 0){
//has no visible child and does not contain text
parent.style.display = "none";
}
});
}
}); });

View File

@ -16,7 +16,6 @@ body {
padding: 0 20px; padding: 0 20px;
font-family: 'Helvetica Neue', Helvetica, sans-serif; font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-size: 16px; font-size: 16px;
line-height: 160%;
} }
img { img {
@ -41,8 +40,13 @@ article a:hover, article a:active {
border-bottom-color: #222; border-bottom-color: #222;
} }
article .description a {
word-break: break-word;
}
p, ul, ol, blockquote { p, ul, ol, blockquote {
margin-bottom: 1em; margin-bottom: 1em;
line-height: 160%;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
@ -65,6 +69,7 @@ h1.page-title {
font-size: 48px; font-size: 48px;
margin: 1em 30px; margin: 1em 30px;
line-height: 100%; line-height: 100%;
word-wrap: break-word;
} }
h2 { h2 {
@ -179,6 +184,10 @@ nav #nav-search{
margin-top: 20px; margin-top: 20px;
} }
nav.wrap a{
word-wrap: break-word;
}
nav h3 { nav h3 {
margin-top: 12px; margin-top: 12px;
font-size: 13px; font-size: 13px;
@ -234,13 +243,12 @@ nav ul ul a:active {
} }
nav h2 { nav h2 {
font-size: 12px; font-size: 13px;
margin: 0; margin: 10px 0 0 0;
padding: 0; padding: 0;
} }
nav > h2 > a { nav > h2 > a {
display: block;
margin: 10px 0 -10px; margin: 10px 0 -10px;
color: #606 !important; color: #606 !important;
} }
@ -596,6 +604,15 @@ span.param-type, .params td .param-type, .param-type dd {
z-index: 1; z-index: 1;
} }
/* nav level */
.level-hide {
display: none;
}
html[data-search-mode] .level-hide {
display: block;
}
@media only screen and (min-width: 320px) and (max-width: 680px) { @media only screen and (min-width: 320px) and (max-width: 680px) {
body { body {
overflow-x: hidden; overflow-x: hidden;

View File

@ -13,6 +13,7 @@
<![endif]--> <![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head> </head>
<body> <body>
@ -24,9 +25,9 @@
<label for="nav-trigger" class="overlay"></label> <label for="nav-trigger" class="overlay"></label>
<nav> <nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="BowserUAIsNotAStringError.html">BowserUAIsNotAStringError</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav> </nav>
<div id="main"> <div id="main">
@ -41,7 +42,7 @@
<section> <section>
<article> <article>
<pre class="prettyprint source linenums"><code>import { BROWSER_ALIASES_MAP } from './constants.js'; <pre class="prettyprint source linenums"><code>import { BROWSER_MAP, BROWSER_ALIASES_MAP } from './constants.js';
export default class Utils { export default class Utils {
/** /**
@ -245,6 +246,19 @@ export default class Utils {
static getBrowserAlias(browserName) { static getBrowserAlias(browserName) {
return BROWSER_ALIASES_MAP[browserName]; return BROWSER_ALIASES_MAP[browserName];
} }
/**
* Get short version/alias for a browser name
*
* @example
* getBrowserAlias('edge') // Microsoft Edge
*
* @param {string} browserName
* @return {string}
*/
static getBrowserTypeByAlias(browserAlia) {
return BROWSER_MAP[browserAlia] || '';
}
} }
</code></pre> </code></pre>
</article> </article>
@ -260,12 +274,14 @@ export default class Utils {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri May 03 2019 21:50:23 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jul 16 2019 22:20:27 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script> <script src="scripts/linenumber.js"></script>
</body> </body>
</html> </html>

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "bowser", "name": "bowser",
"version": "2.4.0", "version": "2.5.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "bowser", "name": "bowser",
"version": "2.4.0", "version": "2.5.0",
"description": "Lightweight browser detector", "description": "Lightweight browser detector",
"keywords": [ "keywords": [
"browser", "browser",