mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'release/2.1.1' into production
# Conflicts: # src/parser-os.js
This commit is contained in:
commit
c3c986c143
@ -3,6 +3,11 @@ extends: airbnb-base
|
|||||||
rules:
|
rules:
|
||||||
no-underscore-dangle: 0
|
no-underscore-dangle: 0
|
||||||
no-void: 0
|
no-void: 0
|
||||||
|
import/extensions:
|
||||||
|
- 'error'
|
||||||
|
- 'ignorePackages'
|
||||||
|
- {js: 'always'}
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- ava
|
- ava
|
||||||
- import
|
- import
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# Bowser Changelog
|
# Bowser Changelog
|
||||||
|
|
||||||
|
### 2.1.1 (January 24, 2019)
|
||||||
|
- [ADD] Add detection of PlayStation 4 (#291)
|
||||||
|
- [ADD] Deploy docs on GH Pages (#293)
|
||||||
|
- [FIX] Fix files extensions for importing (#294)
|
||||||
|
- [FIX] Fix docs (#295)
|
||||||
|
|
||||||
### 2.1.0 (January 24, 2019)
|
### 2.1.0 (January 24, 2019)
|
||||||
- [ADD] Add new `Parser.getEngineName()` method (#288)
|
- [ADD] Add new `Parser.getEngineName()` method (#288)
|
||||||
- [ADD] Add detection of ChromeOS (#287)
|
- [ADD] Add detection of ChromeOS (#287)
|
||||||
|
21
README.md
21
README.md
@ -13,13 +13,12 @@ A browser detector. Because sometimes, there is no other way, and not even good
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
**Changes of version 2.0**
|
### ⚠️ Version 2.0 breaking changes ⚠️
|
||||||
|
|
||||||
The version 2.0 has drastically changed API. All available methods can be found in the `docs` folder from now on and on a webpage soon.
|
Version 2.0 has drastically changed the API. All available methods are on the [docs page](https://lancedikson.github.io/bowser/docs).
|
||||||
|
|
||||||
_For legacy code, check out the [1.x](https://github.com/lancedikson/bowser/tree/v1.x) branch and install it through `npm install bowser@1.9.4`._
|
_For legacy code, check out the [1.x](https://github.com/lancedikson/bowser/tree/v1.x) branch and install it through `npm install bowser@1.9.4`._
|
||||||
|
|
||||||
|
|
||||||
# Use cases
|
# Use cases
|
||||||
|
|
||||||
First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.
|
First of all, require the library. This is a UMD Module, so it will work for AMD, TypeScript, ES6, and CommonJS module systems.
|
||||||
@ -54,20 +53,20 @@ console.log(`The current browser name is "${browser.getBrowserName()}"`);
|
|||||||
or
|
or
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const impression = new Impression();
|
|
||||||
|
|
||||||
const browser = Bowser.getParser(window.navigator.userAgent);
|
const browser = Bowser.getParser(window.navigator.userAgent);
|
||||||
const browserInfo = browser.getBrowser();
|
console.log(browser.getBrowser());
|
||||||
impression.brName = browserInfo.name;
|
|
||||||
impression.brVer = browserInfo.version;
|
// outputs
|
||||||
|
{
|
||||||
|
name: "Internet Explorer"
|
||||||
|
version: "11.0"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const browser = Bowser.getParser(window.navigator.userAgent);
|
console.log(Bowser.parse(window.navigator.userAgent));
|
||||||
impression.userTechData = browser.parse();
|
|
||||||
console.log(impression.userTechData);
|
|
||||||
|
|
||||||
// outputs
|
// outputs
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<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#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#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><a href="global.html">Global</a></h3>
|
<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#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#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">
|
||||||
@ -572,7 +572,7 @@ 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 Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
122
docs/Parser.html
122
docs/Parser.html
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<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#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#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><a href="global.html">Global</a></h3>
|
<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#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#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">
|
||||||
@ -687,6 +687,112 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="name" id="getEngineName"><span class="type-signature"></span>getEngineName<span class="signature">()</span><span class="type-signature"> → {String}</span></h4>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="details">
|
||||||
|
|
||||||
|
|
||||||
|
<dt class="tag-source">Source:</dt>
|
||||||
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line281">line 281</a>
|
||||||
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
<p>Get engines's name</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h5>Returns:</h5>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="param-desc">
|
||||||
|
<p>Engines's name or an empty string</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="param-type">
|
||||||
|
<dt>
|
||||||
|
Type
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
|
||||||
|
<span class="param-type">String</span>
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h4 class="name" id="getOS"><span class="type-signature"></span>getOS<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4>
|
<h4 class="name" id="getOS"><span class="type-signature"></span>getOS<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4>
|
||||||
|
|
||||||
|
|
||||||
@ -1356,7 +1462,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#line317">line 317</a>
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line330">line 330</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@ -1564,7 +1670,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#line446">line 446</a>
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line463">line 463</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@ -1716,7 +1822,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
<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#line304">line 304</a>
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line317">line 317</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@ -1902,7 +2008,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
<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#line279">line 279</a>
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line292">line 292</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@ -2211,7 +2317,7 @@ the OS called "anything" or the platform called "anything"</
|
|||||||
|
|
||||||
<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#line339">line 339</a>
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line352">line 352</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@ -2382,7 +2488,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#line455">line 455</a>
|
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line472">line 472</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@ -2687,7 +2793,7 @@ 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 Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<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#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#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><a href="global.html">Global</a></h3>
|
<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#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#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,7 +47,7 @@
|
|||||||
* 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-2017
|
||||||
*/
|
*/
|
||||||
import Parser from './parser';
|
import Parser from './parser.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bowser class.
|
* Bowser class.
|
||||||
@ -105,7 +105,7 @@ 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 Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
1077
docs/global.html
1077
docs/global.html
File diff suppressed because it is too large
Load Diff
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<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#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#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><a href="global.html">Global</a></h3>
|
<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#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#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">
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
<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 browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.</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></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>
|
<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>
|
||||||
@ -59,31 +59,32 @@
|
|||||||
<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><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>
|
||||||
<p><em>Please, note that this is an alpha version. Check out the <a href="https://github.com/lancedikson/bowser/tree/v1.x">1.x</a> branch for a stable version.</em></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><strong>Changes of version 2.0</strong>
|
<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>
|
||||||
The upcoming 2.0 version has drastically changed API. All available methods can be found in the <code>docs</code> folder from now on and on a webpage soon.</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 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</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 * 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>
|
||||||
<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 impression = new Impression();
|
<pre class="prettyprint source lang-javascript"><code>const browser = Bowser.getParser(window.navigator.userAgent);
|
||||||
|
console.log(browser.getBrowser());
|
||||||
|
|
||||||
const browser = bowser.getParser(window.navigator.userAgent);
|
// outputs
|
||||||
const browserInfo = browser.getBrowser();
|
{
|
||||||
impression.brName = browserInfo.name;
|
name: "Internet Explorer"
|
||||||
impression.brVer = browserInfo.version;</code></pre><p>or</p>
|
version: "11.0"
|
||||||
<pre class="prettyprint source lang-javascript"><code>const browser = bowser.getParser(window.navigator.userAgent);
|
}</code></pre><p>or</p>
|
||||||
impression.userTechData = browser.parse();
|
<pre class="prettyprint source lang-javascript"><code>console.log(Bowser.parse(window.navigator.userAgent));
|
||||||
console.log(impression.userTechData);
|
|
||||||
|
|
||||||
// outputs
|
// outputs
|
||||||
{
|
{
|
||||||
@ -105,7 +106,7 @@ console.log(impression.userTechData);
|
|||||||
}
|
}
|
||||||
}</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({
|
||||||
// declare browsers per OS
|
// declare browsers per OS
|
||||||
windows: {
|
windows: {
|
||||||
@ -135,12 +136,6 @@ const isValidBrowser = browser.satisfies({
|
|||||||
});</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>
|
||||||
<h1>Contributing</h1><p>If you'd like to contribute a change to bowser, modify the files in <code>src/</code>, then run the following (you'll need node + npm installed):</p>
|
|
||||||
<pre class="prettyprint source lang-sh"><code>$ npm install #build
|
|
||||||
$ npm test #run tests
|
|
||||||
$ npm run lint #check lint rules</code></pre><h3>Adding tests</h3><p>See the list in <code>test/acceptance/useragentstrings.yml</code> with example user agents and their expected bowser object.</p>
|
|
||||||
<p>Whenever you add support for new browsers or notice a bug / mismatch, please update the list and
|
|
||||||
check if all tests are still passing.</p>
|
|
||||||
<h3>Similar Projects</h3><ul>
|
<h3>Similar Projects</h3><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>
|
||||||
@ -159,7 +154,7 @@ check if all tests are still passing.</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 Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<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#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#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><a href="global.html">Global</a></h3>
|
<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#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#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,11 +41,11 @@
|
|||||||
|
|
||||||
<section>
|
<section>
|
||||||
<article>
|
<article>
|
||||||
<pre class="prettyprint source linenums"><code>import browserParsersList from './parser-browsers';
|
<pre class="prettyprint source linenums"><code>import browserParsersList from './parser-browsers.js';
|
||||||
import osParsersList from './parser-os';
|
import osParsersList from './parser-os.js';
|
||||||
import platformParsersList from './parser-platforms';
|
import platformParsersList from './parser-platforms.js';
|
||||||
import enginesParsersList from './parser-engines';
|
import enginesParsersList from './parser-engines.js';
|
||||||
import { compareVersions } from './utils';
|
import Utils from './utils.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class that arranges the whole parsing process.
|
* The main class that arranges the whole parsing process.
|
||||||
@ -315,6 +315,19 @@ class Parser {
|
|||||||
return this.parseEngine();
|
return this.parseEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get engines's name
|
||||||
|
* @return {String} Engines's name or an empty string
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
getEngineName(toLowerCase) {
|
||||||
|
if (toLowerCase) {
|
||||||
|
return String(this.getEngine().name).toLowerCase() || '';
|
||||||
|
}
|
||||||
|
return this.getEngine().name || '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get parsed platform
|
* Get parsed platform
|
||||||
* @return {{}}
|
* @return {{}}
|
||||||
@ -468,7 +481,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return expectedResults.indexOf(
|
return expectedResults.indexOf(
|
||||||
compareVersions(currentBrowserVersion, comparableVersion, isLoose),
|
Utils.compareVersions(currentBrowserVersion, comparableVersion, isLoose),
|
||||||
) > -1;
|
) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,6 +493,10 @@ class Parser {
|
|||||||
return this.getPlatformType(true) === String(platformType).toLowerCase();
|
return this.getPlatformType(true) === String(platformType).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isEngine(engineName) {
|
||||||
|
return this.getEngineName(true) === String(engineName).toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is anything? Check if the browser is called "anything",
|
* Is anything? Check if the browser is called "anything",
|
||||||
* the OS called "anything" or the platform called "anything"
|
* the OS called "anything" or the platform called "anything"
|
||||||
@ -515,7 +532,7 @@ 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 Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<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#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#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><a href="global.html">Global</a></h3>
|
<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#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#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 +41,7 @@
|
|||||||
|
|
||||||
<section>
|
<section>
|
||||||
<article>
|
<article>
|
||||||
<pre class="prettyprint source linenums"><code>class Utils {
|
<pre class="prettyprint source linenums"><code>export default class Utils {
|
||||||
/**
|
/**
|
||||||
* Get first matched item for a string
|
* Get first matched item for a string
|
||||||
* @param {RegExp} regexp
|
* @param {RegExp} regexp
|
||||||
@ -231,8 +231,6 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Utils;
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
@ -247,7 +245,7 @@ module.exports = 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 Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>prettyPrint();</script>
|
<script>prettyPrint();</script>
|
||||||
|
2697
package-lock.json
generated
2697
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bowser",
|
"name": "bowser",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"description": "Lightweight browser detector",
|
"description": "Lightweight browser detector",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"browser",
|
"browser",
|
||||||
@ -42,8 +42,9 @@
|
|||||||
"eslint-config-airbnb-base": "^13.1.0",
|
"eslint-config-airbnb-base": "^13.1.0",
|
||||||
"eslint-plugin-ava": "^5.1.0",
|
"eslint-plugin-ava": "^5.1.0",
|
||||||
"eslint-plugin-import": "^2.14.0",
|
"eslint-plugin-import": "^2.14.0",
|
||||||
|
"gh-pages": "^2.0.1",
|
||||||
"jsdoc": "^3.5.5",
|
"jsdoc": "^3.5.5",
|
||||||
"nyc": "^12.0.2",
|
"nyc": "^13.2.0",
|
||||||
"sinon": "^6.1.5",
|
"sinon": "^6.1.5",
|
||||||
"testem": "^2.9.3",
|
"testem": "^2.9.3",
|
||||||
"webpack": "^4.28.4",
|
"webpack": "^4.28.4",
|
||||||
@ -63,6 +64,7 @@
|
|||||||
},
|
},
|
||||||
"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",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"lint": "eslint ./src",
|
"lint": "eslint ./src",
|
||||||
"testem": "testem",
|
"testem": "testem",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* 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-2017
|
||||||
*/
|
*/
|
||||||
import Parser from './parser';
|
import Parser from './parser.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bowser class.
|
* Bowser class.
|
||||||
|
@ -23,10 +23,7 @@
|
|||||||
* return true/false to get the Parser know if this browser descriptor matches the UA or not.
|
* return true/false to get the Parser know if this browser descriptor matches the UA or not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import Utils from './utils.js';
|
||||||
getFirstMatch,
|
|
||||||
getSecondMatch,
|
|
||||||
} from './utils';
|
|
||||||
|
|
||||||
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
|
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
|
||||||
|
|
||||||
@ -38,7 +35,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Googlebot',
|
name: 'Googlebot',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -55,7 +52,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Opera',
|
name: 'Opera',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -72,7 +69,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Opera',
|
name: 'Opera',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -87,7 +84,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Samsung Internet for Android',
|
name: 'Samsung Internet for Android',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -102,7 +99,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'NAVER Whale Browser',
|
name: 'NAVER Whale Browser',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -117,7 +114,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'MZ Browser',
|
name: 'MZ Browser',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -132,7 +129,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Focus',
|
name: 'Focus',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -147,7 +144,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Swing',
|
name: 'Swing',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -162,7 +159,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Opera Coast',
|
name: 'Opera Coast',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -177,7 +174,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Yandex Browser',
|
name: 'Yandex Browser',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -192,7 +189,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'UC Browser',
|
name: 'UC Browser',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -207,7 +204,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Maxthon',
|
name: 'Maxthon',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -222,7 +219,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Epiphany',
|
name: 'Epiphany',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -237,7 +234,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Puffin',
|
name: 'Puffin',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -252,7 +249,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Sleipnir',
|
name: 'Sleipnir',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -267,7 +264,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'K-Meleon',
|
name: 'K-Meleon',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -282,7 +279,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'WeChat',
|
name: 'WeChat',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -297,7 +294,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Internet Explorer',
|
name: 'Internet Explorer',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -313,7 +310,7 @@ const browsersList = [
|
|||||||
name: 'Microsoft Edge',
|
name: 'Microsoft Edge',
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -328,7 +325,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Vivaldi',
|
name: 'Vivaldi',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -343,7 +340,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'SeaMonkey',
|
name: 'SeaMonkey',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -359,7 +356,7 @@ const browsersList = [
|
|||||||
name: 'Sailfish',
|
name: 'Sailfish',
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua);
|
const version = Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -374,7 +371,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Amazon Silk',
|
name: 'Amazon Silk',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -389,7 +386,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'PhantomJS',
|
name: 'PhantomJS',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -404,7 +401,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'SlimerJS',
|
name: 'SlimerJS',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -419,7 +416,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'BlackBerry',
|
name: 'BlackBerry',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -434,7 +431,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'WebOS Browser',
|
name: 'WebOS Browser',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -449,7 +446,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Bada',
|
name: 'Bada',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -464,7 +461,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Tizen',
|
name: 'Tizen',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -479,7 +476,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'QupZilla',
|
name: 'QupZilla',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -494,7 +491,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Firefox',
|
name: 'Firefox',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -509,7 +506,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Chromium',
|
name: 'Chromium',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -524,7 +521,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Chrome',
|
name: 'Chrome',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -545,7 +542,24 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Android Browser',
|
name: 'Android Browser',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
|
if (version) {
|
||||||
|
browser.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
return browser;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
/* PlayStation 4 */
|
||||||
|
{
|
||||||
|
test: [/playstation 4/i],
|
||||||
|
describe(ua) {
|
||||||
|
const browser = {
|
||||||
|
name: 'PlayStation 4',
|
||||||
|
};
|
||||||
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -579,7 +593,7 @@ const browsersList = [
|
|||||||
const browser = {
|
const browser = {
|
||||||
name: 'Safari',
|
name: 'Safari',
|
||||||
};
|
};
|
||||||
const version = getFirstMatch(commonVersionIdentifier, ua);
|
const version = Utils.getFirstMatch(commonVersionIdentifier, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
browser.version = version;
|
browser.version = version;
|
||||||
@ -594,8 +608,8 @@ const browsersList = [
|
|||||||
test: [/.*/i],
|
test: [/.*/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
return {
|
return {
|
||||||
name: getFirstMatch(/^(.*)\/(.*) /, ua),
|
name: Utils.getFirstMatch(/^(.*)\/(.*) /, ua),
|
||||||
version: getSecondMatch(/^(.*)\/(.*) /, ua),
|
version: Utils.getSecondMatch(/^(.*)\/(.*) /, ua),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getFirstMatch } from './utils';
|
import Utils from './utils.js';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* More specific goes first
|
* More specific goes first
|
||||||
@ -10,7 +10,7 @@ export default [
|
|||||||
return parser.getBrowserName(true) === 'microsoft edge';
|
return parser.getBrowserName(true) === 'microsoft edge';
|
||||||
},
|
},
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
return {
|
return {
|
||||||
name: 'EdgeHTML',
|
name: 'EdgeHTML',
|
||||||
version,
|
version,
|
||||||
@ -26,7 +26,7 @@ export default [
|
|||||||
name: 'Trident',
|
name: 'Trident',
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
engine.version = version;
|
engine.version = version;
|
||||||
@ -46,7 +46,7 @@ export default [
|
|||||||
name: 'Presto',
|
name: 'Presto',
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
engine.version = version;
|
engine.version = version;
|
||||||
@ -68,7 +68,7 @@ export default [
|
|||||||
name: 'Gecko',
|
name: 'Gecko',
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
engine.version = version;
|
engine.version = version;
|
||||||
@ -96,7 +96,7 @@ export default [
|
|||||||
name: 'WebKit',
|
name: 'WebKit',
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
|
const version = Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
engine.version = version;
|
engine.version = version;
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
import {
|
import Utils from './utils.js';
|
||||||
getFirstMatch,
|
|
||||||
getWindowsVersionName,
|
|
||||||
getAndroidVersionName,
|
|
||||||
} from './utils';
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
/* Windows Phone */
|
/* Windows Phone */
|
||||||
{
|
{
|
||||||
test: [/windows phone/i],
|
test: [/windows phone/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = 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: 'Windows Phone',
|
||||||
version,
|
version,
|
||||||
@ -21,8 +17,8 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/windows/i],
|
test: [/windows/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, ua);
|
const version = Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, ua);
|
||||||
const versionName = getWindowsVersionName(version);
|
const versionName = Utils.getWindowsVersionName(version);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'Windows',
|
name: 'Windows',
|
||||||
@ -36,7 +32,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/macintosh/i],
|
test: [/macintosh/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = 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: 'macOS',
|
||||||
version,
|
version,
|
||||||
@ -48,7 +44,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/(ipod|iphone|ipad)/i],
|
test: [/(ipod|iphone|ipad)/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = 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: 'iOS',
|
||||||
@ -65,8 +61,8 @@ export default [
|
|||||||
return notLikeAndroid && butAndroid;
|
return notLikeAndroid && butAndroid;
|
||||||
},
|
},
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
|
||||||
const versionName = getAndroidVersionName(version);
|
const versionName = Utils.getAndroidVersionName(version);
|
||||||
const os = {
|
const os = {
|
||||||
name: 'Android',
|
name: 'Android',
|
||||||
version,
|
version,
|
||||||
@ -82,7 +78,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/(web|hpw)[o0]s/i],
|
test: [/(web|hpw)[o0]s/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = 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: 'WebOS',
|
||||||
};
|
};
|
||||||
@ -98,9 +94,9 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, ua)
|
const version = Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, ua)
|
||||||
|| getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, ua)
|
|| Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, ua)
|
||||||
|| getFirstMatch(/\bbb(\d+)/i, ua);
|
|| Utils.getFirstMatch(/\bbb(\d+)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'BlackBerry',
|
name: 'BlackBerry',
|
||||||
@ -113,7 +109,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/bada/i],
|
test: [/bada/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'Bada',
|
name: 'Bada',
|
||||||
@ -126,7 +122,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/tizen/i],
|
test: [/tizen/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
|
const version = Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: 'Tizen',
|
name: 'Tizen',
|
||||||
@ -159,7 +155,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/PlayStation 4/],
|
test: [/PlayStation 4/],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const version = 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: 'PlayStation 4',
|
||||||
version,
|
version,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getFirstMatch } from './utils';
|
import Utils from './utils.js';
|
||||||
|
|
||||||
const TYPES_LABELS = {
|
const TYPES_LABELS = {
|
||||||
tablet: 'tablet',
|
tablet: 'tablet',
|
||||||
@ -28,7 +28,7 @@ export default [
|
|||||||
{
|
{
|
||||||
test: [/huawei/i],
|
test: [/huawei/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const model = getFirstMatch(/(can-l01)/i, ua) && 'Nova';
|
const model = Utils.getFirstMatch(/(can-l01)/i, ua) && 'Nova';
|
||||||
const platform = {
|
const platform = {
|
||||||
type: TYPES_LABELS.mobile,
|
type: TYPES_LABELS.mobile,
|
||||||
vendor: 'Huawei',
|
vendor: 'Huawei',
|
||||||
@ -104,7 +104,7 @@ export default [
|
|||||||
return iDevice && !likeIDevice;
|
return iDevice && !likeIDevice;
|
||||||
},
|
},
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
const model = getFirstMatch(/(ipod|iphone)/i, ua);
|
const model = Utils.getFirstMatch(/(ipod|iphone)/i, ua);
|
||||||
return {
|
return {
|
||||||
type: TYPES_LABELS.mobile,
|
type: TYPES_LABELS.mobile,
|
||||||
vendor: 'Apple',
|
vendor: 'Apple',
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import browserParsersList from './parser-browsers';
|
import browserParsersList from './parser-browsers.js';
|
||||||
import osParsersList from './parser-os';
|
import osParsersList from './parser-os.js';
|
||||||
import platformParsersList from './parser-platforms';
|
import platformParsersList from './parser-platforms.js';
|
||||||
import enginesParsersList from './parser-engines';
|
import enginesParsersList from './parser-engines.js';
|
||||||
import { compareVersions } from './utils';
|
import Utils from './utils.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class that arranges the whole parsing process.
|
* The main class that arranges the whole parsing process.
|
||||||
@ -438,7 +438,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return expectedResults.indexOf(
|
return expectedResults.indexOf(
|
||||||
compareVersions(currentBrowserVersion, comparableVersion, isLoose),
|
Utils.compareVersions(currentBrowserVersion, comparableVersion, isLoose),
|
||||||
) > -1;
|
) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Utils {
|
export default class Utils {
|
||||||
/**
|
/**
|
||||||
* Get first matched item for a string
|
* Get first matched item for a string
|
||||||
* @param {RegExp} regexp
|
* @param {RegExp} regexp
|
||||||
@ -188,5 +188,3 @@ class Utils {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Utils;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user