mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'release/2.5.0' into production
This commit is contained in:
commit
5fc17b73a0
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
github: lancedikson
|
||||||
|
open_collective: lancedikson
|
@ -1,7 +1,7 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
after_success: npm run coverage
|
after_success: npm run coverage
|
||||||
node_js:
|
node_js:
|
||||||
- "8.4.0"
|
- "12"
|
||||||
script:
|
script:
|
||||||
- npm run lint
|
- npm run lint
|
||||||
- npm run build
|
- npm run build
|
||||||
|
@ -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)
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
## Bowser
|
## Bowser
|
||||||
A browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.
|
A small, fast and reach-API browser/platform/engine detector for both browser and node.
|
||||||
|
- **Small.** Use plain ES5-version which is ~4.8kB gzipped.
|
||||||
|
- **Optimized.** Use only those parsers you need — it doesn't do useless work.
|
||||||
|
- **Multi-platform.** It's browser- and node-ready, so you can use it in any environment.
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/lancedikson/bowser.svg?branch=master)](https://travis-ci.org/lancedikson/bowser/) [![Greenkeeper badge](https://badges.greenkeeper.io/lancedikson/bowser.svg)](https://greenkeeper.io/)[![Coverage Status](https://coveralls.io/repos/github/lancedikson/bowser/badge.svg?branch=master)](https://coveralls.io/github/lancedikson/bowser?branch=master)
|
Don't hesitate to support the project on Github or [OpenCollective](https://opencollective.com/bowser) if you like it ❤️ Also, contributors are always welcome!
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/lancedikson/bowser.svg?branch=master)](https://travis-ci.org/lancedikson/bowser/) [![Greenkeeper badge](https://badges.greenkeeper.io/lancedikson/bowser.svg)](https://greenkeeper.io/) [![Coverage Status](https://coveralls.io/repos/github/lancedikson/bowser/badge.svg?branch=master)](https://coveralls.io/github/lancedikson/bowser?branch=master)
|
||||||
|
|
||||||
# Contents
|
# Contents
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
|
116
docs/Bowser.html
116
docs/Bowser.html
@ -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,108 +48,20 @@
|
|||||||
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>
|
||||||
@ -401,6 +317,7 @@ const result = parser.getResult();</code></pre>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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>
|
||||||
|
|
||||||
|
|
||||||
@ -552,6 +471,7 @@ const result = parser.getResult();</code></pre>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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>
|
234
docs/BowserUAIsNotAStringError.html
Normal file
234
docs/BowserUAIsNotAStringError.html
Normal 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>
|
@ -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>
|
||||||
|
|
||||||
|
|
||||||
@ -247,6 +248,9 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -256,6 +260,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -345,6 +351,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -368,6 +376,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -447,6 +456,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -474,6 +485,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -553,6 +565,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -580,6 +594,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -659,6 +674,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -682,6 +699,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -761,6 +779,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -788,6 +808,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -879,6 +900,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -899,6 +922,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1042,6 +1066,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -1066,6 +1092,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1145,6 +1172,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1172,6 +1201,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1251,6 +1281,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1274,6 +1306,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1425,6 +1458,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -1445,6 +1480,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1524,6 +1560,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1547,6 +1585,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1626,6 +1665,8 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1653,6 +1694,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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 "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -1805,6 +1849,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1981,6 +2026,8 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -2001,6 +2048,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2081,6 +2129,9 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2164,6 +2215,8 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2187,6 +2240,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2266,6 +2320,8 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2289,6 +2345,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2368,6 +2425,8 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2394,6 +2453,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2473,6 +2533,8 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2496,6 +2558,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2639,6 +2702,8 @@ and should have browsers specs on the bottom-laying layer</p></td>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -2667,6 +2732,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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>
|
||||||
|
|
||||||
|
|
||||||
@ -2818,6 +2886,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2949,6 +3018,8 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -2969,6 +3040,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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>
|
@ -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>
|
||||||
|
221
docs/global.html
221
docs/global.html
@ -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">
|
||||||
@ -106,6 +107,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -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>
|
||||||
|
|
||||||
|
|
||||||
@ -291,6 +296,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -427,6 +433,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -447,6 +455,166 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="name" id="getBrowserTypeByAlias"><span class="type-signature"></span>getBrowserTypeByAlias<span class="signature">(browserName)</span><span class="type-signature"> → {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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -601,6 +769,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -633,6 +803,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -782,6 +953,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -814,6 +987,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -950,6 +1124,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -970,6 +1146,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1124,6 +1301,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -1144,6 +1323,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1321,6 +1501,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h5>Returns:</h5>
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
@ -1341,6 +1523,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1995,12 +2178,14 @@ like <code>"iPhone"</code> or <code>"Kindle Fire HD 7"</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>
|
@ -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,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<section class="package">
|
||||||
|
<h3> </h3>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -49,33 +55,50 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<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("bowser"); // CommonJS
|
<pre class="prettyprint source lang-javascript"><code>const Bowser = require("bowser"); // CommonJS
|
||||||
|
|
||||||
import * as Bowser from "bowser"; // TypeScript
|
import * as Bowser from "bowser"; // TypeScript
|
||||||
|
|
||||||
import Bowser from "bowser"; // 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 "bowser"; // 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 "${browser.getBrowserName()}"`);
|
console.log(`The current browser name is "${browser.getBrowserName()}"`);
|
||||||
// The current browser name is "Internet Explorer"</code></pre><p>or</p>
|
// The current browser name is "Internet Explorer"
|
||||||
|
</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: "Internet Explorer"
|
name: "Internet Explorer"
|
||||||
version: "11.0"
|
version: "11.0"
|
||||||
}</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: "Trident"
|
name: "Trident"
|
||||||
version: "7.0"
|
version: "7.0"
|
||||||
}
|
}
|
||||||
}</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: "~20" // will match any 20.* sub-version
|
chrome: "~20" // will match any 20.* sub-version
|
||||||
chrome: "~20.1" // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
|
chrome: "~20.1" // 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>
|
@ -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 && typeof alias !== 'undefined') {
|
if (includingAlias && 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>
|
||||||
|
@ -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
12
docs/scripts/nav.js
Normal 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
4
docs/scripts/polyfill.js
Normal 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;
|
||||||
|
}
|
@ -1,42 +1,83 @@
|
|||||||
$( document ).ready(function() {
|
|
||||||
jQuery.expr[':'].Contains = function(a,i,m){
|
var searchAttr = 'data-search-mode';
|
||||||
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
|
function contains(a,m){
|
||||||
};
|
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m) !== -1;
|
||||||
//on search
|
};
|
||||||
$("#nav-search").on("keyup", function(event) {
|
|
||||||
var search = $(this).val();
|
//on search
|
||||||
if (!search) {
|
document.getElementById("nav-search").addEventListener("keyup", function(event) {
|
||||||
//no search, show all results
|
var search = this.value.toUpperCase();
|
||||||
$("nav > ul > li").show();
|
|
||||||
|
if (!search) {
|
||||||
if(typeof hideAllButCurrent === "function"){
|
//no search, show all results
|
||||||
//let's do what ever collapse wants to do
|
document.documentElement.removeAttribute(searchAttr);
|
||||||
hideAllButCurrent();
|
|
||||||
}
|
document.querySelectorAll("nav > ul > li:not(.level-hide)").forEach(function(elem) {
|
||||||
else{
|
elem.style.display = "block";
|
||||||
//menu by default should be opened
|
});
|
||||||
$("nav > ul > li > ul li").show();
|
|
||||||
}
|
if (typeof hideAllButCurrent === "function"){
|
||||||
}
|
//let's do what ever collapse wants to do
|
||||||
else{
|
hideAllButCurrent();
|
||||||
//we are searching
|
} else {
|
||||||
//show all parents
|
//menu by default should be opened
|
||||||
$("nav > ul > li").show();
|
document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
|
||||||
//hide all results
|
elem.style.display = "block";
|
||||||
$("nav > ul > li > ul li").hide();
|
|
||||||
//show results matching filter
|
|
||||||
$("nav > ul > li > ul").find("a:Contains("+search+")").parent().show();
|
|
||||||
//hide parents without children
|
|
||||||
$("nav > ul > li").each(function(){
|
|
||||||
if($(this).find("a:Contains("+search+")").length == 0 && $(this).children("ul").length === 0){
|
|
||||||
//has no child at all and does not contain text
|
|
||||||
$(this).hide();
|
|
||||||
}
|
|
||||||
else if($(this).find("a:Contains("+search+")").length == 0 && $(this).find("ul").children(':visible').length == 0){
|
|
||||||
//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";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
@ -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;
|
||||||
|
@ -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>
|
||||||
|
9393
package-lock.json
generated
9393
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
48
package.json
48
package.json
@ -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",
|
||||||
@ -26,29 +26,29 @@
|
|||||||
"url": "git+https://github.com/lancedikson/bowser.git"
|
"url": "git+https://github.com/lancedikson/bowser.git"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.2.3",
|
"@babel/cli": "^7.5.0",
|
||||||
"@babel/core": "^7.2.2",
|
"@babel/core": "^7.5.4",
|
||||||
"@babel/polyfill": "^7.2.5",
|
"@babel/polyfill": "^7.4.4",
|
||||||
"@babel/preset-env": "^7.2.3",
|
"@babel/preset-env": "^7.5.4",
|
||||||
"@babel/register": "^7.0.0",
|
"@babel/register": "^7.4.4",
|
||||||
"ava": "^1.4.1",
|
"ava": "^2.2.0",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.2",
|
||||||
"babel-loader": "^8.0.5",
|
"babel-loader": "^8.0.6",
|
||||||
"babel-plugin-add-module-exports": "^1.0.2",
|
"babel-plugin-add-module-exports": "^1.0.2",
|
||||||
"babel-plugin-istanbul": "^5.1.1",
|
"babel-plugin-istanbul": "^5.1.4",
|
||||||
"coveralls": "^3.0.2",
|
"coveralls": "^3.0.5",
|
||||||
"docdash": "^1.0.0",
|
"docdash": "^1.1.1",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^6.0.1",
|
||||||
"eslint-config-airbnb-base": "^13.1.0",
|
"eslint-config-airbnb-base": "^13.2.0",
|
||||||
"eslint-plugin-ava": "^6.0.0",
|
"eslint-plugin-ava": "^7.1.0",
|
||||||
"eslint-plugin-import": "^2.17.2",
|
"eslint-plugin-import": "^2.18.0",
|
||||||
"gh-pages": "^2.0.1",
|
"gh-pages": "^2.0.1",
|
||||||
"jsdoc": "^3.5.5",
|
"jsdoc": "^3.6.3",
|
||||||
"nyc": "^14.0.0",
|
"nyc": "^14.1.1",
|
||||||
"sinon": "^7.2.4",
|
"sinon": "^7.3.2",
|
||||||
"testem": "^2.15.1",
|
"testem": "^2.17.0",
|
||||||
"webpack": "^4.28.4",
|
"webpack": "^4.35.3",
|
||||||
"webpack-cli": "^3.2.1",
|
"webpack-cli": "^3.3.6",
|
||||||
"yamljs": "^0.3.0"
|
"yamljs": "^0.3.0"
|
||||||
},
|
},
|
||||||
"ava": {
|
"ava": {
|
||||||
@ -64,14 +64,14 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --config webpack.config.js",
|
"build": "webpack --config webpack.config.js",
|
||||||
"deploy": "jsdoc -c jsdoc.json && gh-pages --dist docs --dest docs",
|
"generate-and-deploy-docs": "npm run generate-docs && gh-pages --dist docs --dest docs",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"lint": "eslint ./src",
|
"lint": "eslint ./src",
|
||||||
"testem": "testem",
|
"testem": "testem",
|
||||||
"test": "nyc --reporter=html --reporter=text ava",
|
"test": "nyc --reporter=html --reporter=text ava",
|
||||||
"test:watch": "ava --watch",
|
"test:watch": "ava --watch",
|
||||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||||
"docs": "jsdoc -c jsdoc.json"
|
"generate-docs": "jsdoc -c jsdoc.json"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,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.
|
||||||
@ -12,15 +29,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);
|
||||||
@ -28,7 +50,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);
|
||||||
}
|
}
|
||||||
@ -45,6 +67,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;
|
||||||
|
@ -35,4 +35,74 @@ export const BROWSER_ALIASES_MAP = {
|
|||||||
'WebOS Browser': 'webos',
|
'WebOS Browser': 'webos',
|
||||||
WeChat: 'wechat',
|
WeChat: 'wechat',
|
||||||
'Yandex Browser': 'yandex',
|
'Yandex Browser': 'yandex',
|
||||||
|
Roku: 'roku',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const BROWSER_MAP = {
|
||||||
|
amazon_silk: 'Amazon Silk',
|
||||||
|
android: 'Android Browser',
|
||||||
|
bada: 'Bada',
|
||||||
|
blackberry: 'BlackBerry',
|
||||||
|
chrome: 'Chrome',
|
||||||
|
chromium: 'Chromium',
|
||||||
|
epiphany: 'Epiphany',
|
||||||
|
firefox: 'Firefox',
|
||||||
|
focus: 'Focus',
|
||||||
|
generic: 'Generic',
|
||||||
|
googlebot: 'Googlebot',
|
||||||
|
ie: 'Internet Explorer',
|
||||||
|
k_meleon: 'K-Meleon',
|
||||||
|
maxthon: 'Maxthon',
|
||||||
|
edge: 'Microsoft Edge',
|
||||||
|
mz: 'MZ Browser',
|
||||||
|
naver: 'NAVER Whale Browser',
|
||||||
|
opera: 'Opera',
|
||||||
|
opera_coast: 'Opera Coast',
|
||||||
|
phantomjs: 'PhantomJS',
|
||||||
|
puffin: 'Puffin',
|
||||||
|
qupzilla: 'QupZilla',
|
||||||
|
safari: 'Safari',
|
||||||
|
sailfish: 'Sailfish',
|
||||||
|
samsung_internet: 'Samsung Internet for Android',
|
||||||
|
seamonkey: 'SeaMonkey',
|
||||||
|
sleipnir: 'Sleipnir',
|
||||||
|
swing: 'Swing',
|
||||||
|
tizen: 'Tizen',
|
||||||
|
uc: 'UC Browser',
|
||||||
|
vivaldi: 'Vivaldi',
|
||||||
|
webos: 'WebOS Browser',
|
||||||
|
wechat: 'WeChat',
|
||||||
|
yandex: 'Yandex Browser',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const PLATFORMS_MAP = {
|
||||||
|
tablet: 'tablet',
|
||||||
|
mobile: 'mobile',
|
||||||
|
desktop: 'desktop',
|
||||||
|
tv: 'tv',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const OS_MAP = {
|
||||||
|
WindowsPhone: 'Windows Phone',
|
||||||
|
Windows: 'Windows',
|
||||||
|
MacOS: 'macOS',
|
||||||
|
iOS: 'iOS',
|
||||||
|
Android: 'Android',
|
||||||
|
WebOS: 'WebOS',
|
||||||
|
BlackBerry: 'BlackBerry',
|
||||||
|
Bada: 'Bada',
|
||||||
|
Tizen: 'Tizen',
|
||||||
|
Linux: 'Linux',
|
||||||
|
ChromeOS: 'Chrome OS',
|
||||||
|
PlayStation4: 'PlayStation 4',
|
||||||
|
Roku: 'Roku',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ENGINE_MAP = {
|
||||||
|
EdgeHTML: 'EdgeHTML',
|
||||||
|
Blink: 'Blink',
|
||||||
|
Trident: 'Trident',
|
||||||
|
Presto: 'Presto',
|
||||||
|
Gecko: 'Gecko',
|
||||||
|
WebKit: 'WebKit',
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Utils from './utils.js';
|
import Utils from './utils.js';
|
||||||
|
import { ENGINE_MAP } from './constants.js';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* More specific goes first
|
* More specific goes first
|
||||||
@ -15,7 +16,7 @@ export default [
|
|||||||
// return blink if it's blink-based one
|
// return blink if it's blink-based one
|
||||||
if (isBlinkBased) {
|
if (isBlinkBased) {
|
||||||
return {
|
return {
|
||||||
name: 'Blink',
|
name: ENGINE_MAP.Blink,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ export default [
|
|||||||
const version = Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'EdgeHTML',
|
name: ENGINE_MAP.EdgeHTML,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -34,7 +35,7 @@ export default [
|
|||||||
test: [/trident/i],
|
test: [/trident/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const engine = {
|
const engine = {
|
||||||
name: 'Trident',
|
name: ENGINE_MAP.Trident,
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
@ -54,7 +55,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const engine = {
|
const engine = {
|
||||||
name: 'Presto',
|
name: ENGINE_MAP.Presto,
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
@ -76,7 +77,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const engine = {
|
const engine = {
|
||||||
name: 'Gecko',
|
name: ENGINE_MAP.Gecko,
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
@ -94,7 +95,7 @@ export default [
|
|||||||
test: [/(apple)?webkit\/537\.36/i],
|
test: [/(apple)?webkit\/537\.36/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
name: 'Blink',
|
name: ENGINE_MAP.Blink,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -104,7 +105,7 @@ export default [
|
|||||||
test: [/(apple)?webkit/i],
|
test: [/(apple)?webkit/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const engine = {
|
const engine = {
|
||||||
name: 'WebKit',
|
name: ENGINE_MAP.WebKit,
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
@ -1,13 +1,26 @@
|
|||||||
import Utils from './utils.js';
|
import Utils from './utils.js';
|
||||||
|
import { OS_MAP } from './constants.js';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
/* Roku */
|
||||||
|
{
|
||||||
|
test: [/Roku\/DVP/],
|
||||||
|
describe(ua) {
|
||||||
|
const version = Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, ua);
|
||||||
|
return {
|
||||||
|
name: OS_MAP.Roku,
|
||||||
|
version,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
/* Windows Phone */
|
/* Windows Phone */
|
||||||
{
|
{
|
||||||
test: [/windows phone/i],
|
test: [/windows phone/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua);
|
||||||
return {
|
return {
|
||||||
name: 'Windows Phone',
|
name: OS_MAP.WindowsPhone,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -21,7 +34,7 @@ export default [
|
|||||||
const versionName = Utils.getWindowsVersionName(version);
|
const versionName = Utils.getWindowsVersionName(version);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'Windows',
|
name: OS_MAP.Windows,
|
||||||
version,
|
version,
|
||||||
versionName,
|
versionName,
|
||||||
};
|
};
|
||||||
@ -34,7 +47,7 @@ export default [
|
|||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, '.');
|
const version = Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, '.');
|
||||||
return {
|
return {
|
||||||
name: 'macOS',
|
name: OS_MAP.MacOS,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -47,7 +60,7 @@ export default [
|
|||||||
const version = Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, ua).replace(/[_\s]/g, '.');
|
const version = Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, ua).replace(/[_\s]/g, '.');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'iOS',
|
name: OS_MAP.iOS,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -64,7 +77,7 @@ export default [
|
|||||||
const version = Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
|
||||||
const versionName = Utils.getAndroidVersionName(version);
|
const versionName = Utils.getAndroidVersionName(version);
|
||||||
const os = {
|
const os = {
|
||||||
name: 'Android',
|
name: OS_MAP.Android,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
if (versionName) {
|
if (versionName) {
|
||||||
@ -80,7 +93,7 @@ export default [
|
|||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, ua);
|
||||||
const os = {
|
const os = {
|
||||||
name: 'WebOS',
|
name: OS_MAP.WebOS,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (version && version.length) {
|
if (version && version.length) {
|
||||||
@ -99,7 +112,7 @@ export default [
|
|||||||
|| Utils.getFirstMatch(/\bbb(\d+)/i, ua);
|
|| Utils.getFirstMatch(/\bbb(\d+)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'BlackBerry',
|
name: OS_MAP.BlackBerry,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -112,7 +125,7 @@ export default [
|
|||||||
const version = Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'Bada',
|
name: OS_MAP.Bada,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -125,7 +138,7 @@ export default [
|
|||||||
const version = Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'Tizen',
|
name: OS_MAP.Tizen,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -136,7 +149,7 @@ export default [
|
|||||||
test: [/linux/i],
|
test: [/linux/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
name: 'Linux',
|
name: OS_MAP.Linux,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -146,7 +159,7 @@ export default [
|
|||||||
test: [/CrOS/],
|
test: [/CrOS/],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
name: 'Chrome OS',
|
name: OS_MAP.ChromeOS,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -157,7 +170,7 @@ export default [
|
|||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, ua);
|
||||||
return {
|
return {
|
||||||
name: 'PlayStation 4',
|
name: OS_MAP.PlayStation4,
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
import Utils from './utils.js';
|
import Utils from './utils.js';
|
||||||
|
import { PLATFORMS_MAP } from './constants.js';
|
||||||
const TYPES_LABELS = {
|
|
||||||
tablet: 'tablet',
|
|
||||||
mobile: 'mobile',
|
|
||||||
desktop: 'desktop',
|
|
||||||
tv: 'tv',
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tablets go first since usually they have more specific
|
* Tablets go first since usually they have more specific
|
||||||
@ -30,7 +24,7 @@ export default [
|
|||||||
describe(ua) {
|
describe(ua) {
|
||||||
const model = Utils.getFirstMatch(/(can-l01)/i, ua) && 'Nova';
|
const model = Utils.getFirstMatch(/(can-l01)/i, ua) && 'Nova';
|
||||||
const platform = {
|
const platform = {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
vendor: 'Huawei',
|
vendor: 'Huawei',
|
||||||
};
|
};
|
||||||
if (model) {
|
if (model) {
|
||||||
@ -45,7 +39,7 @@ export default [
|
|||||||
test: [/nexus\s*(?:7|8|9|10).*/i],
|
test: [/nexus\s*(?:7|8|9|10).*/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tablet,
|
type: PLATFORMS_MAP.tablet,
|
||||||
vendor: 'Nexus',
|
vendor: 'Nexus',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -56,7 +50,7 @@ export default [
|
|||||||
test: [/ipad/i],
|
test: [/ipad/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tablet,
|
type: PLATFORMS_MAP.tablet,
|
||||||
vendor: 'Apple',
|
vendor: 'Apple',
|
||||||
model: 'iPad',
|
model: 'iPad',
|
||||||
};
|
};
|
||||||
@ -68,7 +62,7 @@ export default [
|
|||||||
test: [/kftt build/i],
|
test: [/kftt build/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tablet,
|
type: PLATFORMS_MAP.tablet,
|
||||||
vendor: 'Amazon',
|
vendor: 'Amazon',
|
||||||
model: 'Kindle Fire HD 7',
|
model: 'Kindle Fire HD 7',
|
||||||
};
|
};
|
||||||
@ -80,7 +74,7 @@ export default [
|
|||||||
test: [/silk/i],
|
test: [/silk/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tablet,
|
type: PLATFORMS_MAP.tablet,
|
||||||
vendor: 'Amazon',
|
vendor: 'Amazon',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -91,7 +85,7 @@ export default [
|
|||||||
test: [/tablet/i],
|
test: [/tablet/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tablet,
|
type: PLATFORMS_MAP.tablet,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -106,7 +100,7 @@ export default [
|
|||||||
describe(ua) {
|
describe(ua) {
|
||||||
const model = Utils.getFirstMatch(/(ipod|iphone)/i, ua);
|
const model = Utils.getFirstMatch(/(ipod|iphone)/i, ua);
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
vendor: 'Apple',
|
vendor: 'Apple',
|
||||||
model,
|
model,
|
||||||
};
|
};
|
||||||
@ -118,7 +112,7 @@ export default [
|
|||||||
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
vendor: 'Nexus',
|
vendor: 'Nexus',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -129,7 +123,7 @@ export default [
|
|||||||
test: [/[^-]mobi/i],
|
test: [/[^-]mobi/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -141,7 +135,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
vendor: 'BlackBerry',
|
vendor: 'BlackBerry',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -154,7 +148,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -166,7 +160,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
vendor: 'Microsoft',
|
vendor: 'Microsoft',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -180,7 +174,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tablet,
|
type: PLATFORMS_MAP.tablet,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -192,7 +186,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: PLATFORMS_MAP.mobile,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -204,7 +198,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.desktop,
|
type: PLATFORMS_MAP.desktop,
|
||||||
vendor: 'Apple',
|
vendor: 'Apple',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -217,7 +211,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.desktop,
|
type: PLATFORMS_MAP.desktop,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -229,7 +223,7 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.desktop,
|
type: PLATFORMS_MAP.desktop,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -241,7 +235,19 @@ export default [
|
|||||||
},
|
},
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.tv,
|
type: PLATFORMS_MAP.tv,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Roku */
|
||||||
|
{
|
||||||
|
test(parser) {
|
||||||
|
return parser.getOSName(true) === 'roku';
|
||||||
|
},
|
||||||
|
describe() {
|
||||||
|
return {
|
||||||
|
type: PLATFORMS_MAP.tv,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -409,15 +409,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 && typeof alias !== 'undefined') {
|
if (includingAlias && alias) {
|
||||||
possibleNames.push(alias.toLowerCase());
|
browserNameLower = alias.toLowerCase();
|
||||||
}
|
}
|
||||||
|
return browserNameLower === defaultBrowserName;
|
||||||
return possibleNames.indexOf(browserName.toLowerCase()) !== -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compareVersion(version) {
|
compareVersion(version) {
|
||||||
|
15
src/utils.js
15
src/utils.js
@ -1,4 +1,4 @@
|
|||||||
import { BROWSER_ALIASES_MAP } from './constants.js';
|
import { BROWSER_MAP, BROWSER_ALIASES_MAP } from './constants.js';
|
||||||
|
|
||||||
export default class Utils {
|
export default class Utils {
|
||||||
/**
|
/**
|
||||||
@ -202,4 +202,17 @@ 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] || '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,6 +308,18 @@
|
|||||||
type: "mobile"
|
type: "mobile"
|
||||||
engine:
|
engine:
|
||||||
name: "Blink"
|
name: "Blink"
|
||||||
|
- ua: "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Roku/DVP-7.53 (147.53E04068A)"
|
||||||
|
spec:
|
||||||
|
browser:
|
||||||
|
name: "Chrome"
|
||||||
|
version: "60.0.3112.113"
|
||||||
|
os:
|
||||||
|
name: "Roku"
|
||||||
|
version: "7.53"
|
||||||
|
platform:
|
||||||
|
type: "tv"
|
||||||
|
engine:
|
||||||
|
name: "Blink"
|
||||||
Amazon Silk:
|
Amazon Silk:
|
||||||
-
|
-
|
||||||
ua: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true"
|
ua: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true"
|
||||||
@ -2666,3 +2678,16 @@
|
|||||||
engine:
|
engine:
|
||||||
name: "WebKit"
|
name: "WebKit"
|
||||||
version: "605.1.15"
|
version: "605.1.15"
|
||||||
|
Roku:
|
||||||
|
-
|
||||||
|
ua: "Roku/DVP-9.0 (047.00E09044A)"
|
||||||
|
spec:
|
||||||
|
browser:
|
||||||
|
name: "Roku"
|
||||||
|
version: "DVP-9.0"
|
||||||
|
os:
|
||||||
|
name: "Roku"
|
||||||
|
version: "9.0"
|
||||||
|
platform:
|
||||||
|
type: "tv"
|
||||||
|
engine: {}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
import Parser from '../../src/parser';
|
import Parser from '../../src/parser';
|
||||||
|
import Bowser from '../../src/bowser';
|
||||||
|
|
||||||
const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.1165';
|
const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.1165';
|
||||||
const parser = new Parser(UA, true);
|
const parser = new Parser(UA, true);
|
||||||
@ -164,6 +165,12 @@ test('Parser.is should pass', (t) => {
|
|||||||
t.is(parser.is('macos'), true);
|
t.is(parser.is('macos'), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Parser.is using constants should pass', (t) => {
|
||||||
|
t.is(parser.is(Bowser.BROWSER_MAP.opera), true);
|
||||||
|
t.is(parser.is(Bowser.PLATFORMS_MAP.desktop), true);
|
||||||
|
t.is(parser.is(Bowser.OS_MAP.MacOS), true);
|
||||||
|
});
|
||||||
|
|
||||||
test('Parser.some should pass', (t) => {
|
test('Parser.some should pass', (t) => {
|
||||||
t.is(parser.some(['opera', 'chrome', 'firefox']), true);
|
t.is(parser.some(['opera', 'chrome', 'firefox']), true);
|
||||||
t.is(parser.some(['macos', 'windows']), true);
|
t.is(parser.some(['macos', 'windows']), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user