mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8c489bd98b | ||
|
5bab4ee97d | ||
|
16c9f22546 | ||
|
327e6f5e51 | ||
|
0626bf8c8c | ||
|
94ab87ec0e | ||
|
07462efb6a | ||
|
f8fcea59e7 | ||
|
4481f5aab3 | ||
|
0c7380dbf9 | ||
|
bb8f94efcd | ||
|
29222b2fcf | ||
|
69bc6c2dbf | ||
|
9c1588a43e | ||
|
fefa53ad95 | ||
|
efb8e612a5 | ||
|
b86bce16af | ||
|
f09411489c | ||
|
e188e8aa73 | ||
|
1d64ecab12 | ||
|
5b11ac25ca | ||
|
53d54e248c | ||
|
b7c67e9094 | ||
|
b2383edfcd | ||
|
e431acf578 | ||
|
c504b110bb | ||
|
a6317d24ca | ||
|
24dab5f699 | ||
|
444c54a726 | ||
|
bf24d05d5e | ||
|
1e4c408452 | ||
|
0deba6685e | ||
|
a9c4677c86 | ||
|
53d18c8994 | ||
|
d5fe5657d1 | ||
|
c925fd755b | ||
|
867992471a | ||
|
1bde6c6c7e | ||
|
d1a6532d82 |
@ -1 +1 @@
|
||||
repo_token: Ba2bS7pOlSLZWuESBnff8qxDjIS8Mg1Z0
|
||||
|
||||
|
19
.github/release-drafter.yml
vendored
Normal file
19
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name-template: 'v$RESOLVED_VERSION 🌈'
|
||||
tag-template: 'v$RESOLVED_VERSION'
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- major
|
||||
minor:
|
||||
labels:
|
||||
- minor
|
||||
patch:
|
||||
labels:
|
||||
- patch
|
||||
default: patch
|
||||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
||||
change-title-escapes: '\<*_&'
|
||||
template: |
|
||||
## Changes
|
||||
|
||||
$CHANGES
|
20
.github/workflows/draft-or-update-next-release.yml
vendored
Normal file
20
.github/workflows/draft-or-update-next-release.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: 📝 Draft or update next release
|
||||
concurrency: draft_or_update_next_release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prepare-deployment:
|
||||
name: 📝 Draft or update next release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
38
.github/workflows/merge-to-master.yml
vendored
Normal file
38
.github/workflows/merge-to-master.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: 'Merge to master'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.16.3]
|
||||
|
||||
steps:
|
||||
- name: Get branch name (merge)
|
||||
if: github.event_name != 'pull_request'
|
||||
shell: bash
|
||||
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
|
||||
|
||||
- name: Get branch name (pull request)
|
||||
if: github.event_name == 'pull_request'
|
||||
shell: bash
|
||||
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm i -g nyc
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: nyc npm test && nyc report --reporter=text-lcov | ./node_modules/coveralls/bin/coveralls.js
|
||||
env:
|
||||
COVERALLS_SERVICE_NAME: GithubActions
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
COVERALLS_GIT_BRANCH: ${{ env.BRANCH_NAME }}
|
27
.github/workflows/nodejs.yml
vendored
27
.github/workflows/nodejs.yml
vendored
@ -1,27 +0,0 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.16.3]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm ci, build, and test
|
||||
run: |
|
||||
npm ci
|
||||
npm run lint
|
||||
npm run build
|
||||
npm test
|
||||
env:
|
||||
CI: true
|
29
.github/workflows/publish.yml
vendored
Normal file
29
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
# This job runs when a new release is published
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: https://registry.npmjs.org
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||
# Store the name of the release
|
||||
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
|
||||
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
- run: npm ci
|
||||
- run: npm version $RELEASE_VERSION --no-git-tag-version
|
||||
- run: npm run build
|
||||
- run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.BOWSER_NPM_PUBLISH_TOKEN }}
|
44
.github/workflows/pull-request.yml
vendored
Normal file
44
.github/workflows/pull-request.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: 'Pull Request'
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [12.16.3]
|
||||
name: Node ${{ matrix.node }}
|
||||
steps:
|
||||
- name: 'Checkout latest code'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set up node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
|
||||
lint:
|
||||
name: 'ESLint'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout latest code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set up node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npm run lint:check
|
@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
after_success: npm run coverage
|
||||
node_js:
|
||||
- "12.16.3"
|
||||
script:
|
||||
- npm run lint
|
||||
- npm run build
|
||||
- npm test
|
@ -1,5 +1,10 @@
|
||||
# Bowser Changelog
|
||||
|
||||
### 2.11.0 (Sep 12, 2020)
|
||||
- [ADD] Added support for aliases in `Parser#is` method (#437)
|
||||
- [ADD] Added more typings (#438, #427)
|
||||
- [ADD] Added support for MIUI Browser (#436)
|
||||
|
||||
### 2.10.0 (Jul 9, 2020)
|
||||
- [FIX] Fix for Firefox detection on iOS 13 [#415]
|
||||
- [FIX] Fixes for typings.d.ts [#409]
|
||||
|
@ -11,8 +11,6 @@ Don't hesitate to support the project on Github or [OpenCollective](https://open
|
||||
# Contents
|
||||
- [Overview](#overview)
|
||||
- [Use cases](#use-cases)
|
||||
- [Advanced usage](#advanced-usage)
|
||||
- [How can I help?](#contributing)
|
||||
|
||||
# Overview
|
||||
|
||||
@ -20,7 +18,7 @@ The library is made to help to detect what browser your user has and gives you a
|
||||
|
||||
### ⚠️ Version 2.0 breaking changes ⚠️
|
||||
|
||||
Version 2.0 has drastically changed the API. All available methods are on the [docs page](https://lancedikson.github.io/bowser/docs).
|
||||
Version 2.0 has drastically changed the API. All available methods are on the [docs page](https://bowser-js.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`._
|
||||
|
||||
@ -149,7 +147,7 @@ list of aliases can be found in [the file](src/constants.js).
|
||||
|
||||
### Code Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
||||
This project exists thanks to all the people who contribute. [[Contribute](.github/CONTRIBUTING.md)].
|
||||
<a href="https://github.com/lancedikson/bowser/graphs/contributors"><img src="https://opencollective.com/bowser/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
### Financial Contributors
|
||||
|
@ -492,7 +492,7 @@ explicitly. Same as <code>skipParsing</code> for <a href="Parser.html">Parser</a
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
@ -1498,7 +1498,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
||||
|
||||
<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#line330">line 330</a>
|
||||
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line331">line 331</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1700,7 +1700,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="is"><span class="type-signature"></span>is<span class="signature">(anything)</span><span class="type-signature"> → {Boolean}</span></h4>
|
||||
<h4 class="name" id="is"><span class="type-signature"></span>is<span class="signature">(anything, includingAlias<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Boolean}</span></h4>
|
||||
|
||||
|
||||
|
||||
@ -1712,7 +1712,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
|
||||
|
||||
<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#line479">line 479</a>
|
||||
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line481">line 481</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1779,9 +1779,13 @@ the OS called "anything" or the platform called "anything"</
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
<th>Default</th>
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -1804,13 +1808,59 @@ the OS called "anything" or the platform called "anything"</
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="default">
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>includingAlias</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="default">
|
||||
|
||||
<code>false</code>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="description last"><p>The flag showing whether alias will be included into comparison</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -1867,7 +1917,7 @@ the OS called "anything" or the platform called "anything"</
|
||||
|
||||
<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#line414">line 414</a>
|
||||
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line415">line 415</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -2054,7 +2104,7 @@ the OS called "anything" or the platform called "anything"</
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">()</span><span class="type-signature"> → {<a href="Parser.html">Parser</a>}</span></h4>
|
||||
|
||||
|
||||
|
||||
@ -2066,7 +2116,7 @@ the OS called "anything" or the platform called "anything"</
|
||||
|
||||
<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#line317">line 317</a>
|
||||
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line318">line 318</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -2131,6 +2181,24 @@ the OS called "anything" or the platform called "anything"</
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="param-type">
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type"><a href="Parser.html">Parser</a></span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
@ -2576,7 +2644,7 @@ the OS called "anything" or the platform called "anything"</
|
||||
|
||||
<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#line352">line 352</a>
|
||||
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line353">line 353</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -2750,7 +2818,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
|
||||
|
||||
<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#line488">line 488</a>
|
||||
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line491">line 491</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -3061,7 +3129,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
@ -133,7 +133,7 @@ export default Bowser;
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
@ -2706,7 +2706,7 @@ like <code>"iPhone"</code> or <code>"Kindle Fire HD 7"</code
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
@ -210,7 +210,7 @@ list of aliases can be found in <a href="src/constants.js">the file</a>.</p>
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
@ -357,6 +357,7 @@ class Parser {
|
||||
|
||||
/**
|
||||
* Parse full information about the browser
|
||||
* @returns {Parser}
|
||||
*/
|
||||
parse() {
|
||||
this.parseBrowser();
|
||||
@ -518,10 +519,12 @@ class Parser {
|
||||
* Is anything? Check if the browser is called "anything",
|
||||
* the OS called "anything" or the platform called "anything"
|
||||
* @param {String} anything
|
||||
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
is(anything) {
|
||||
return this.isBrowser(anything) || this.isOS(anything) || this.isPlatform(anything);
|
||||
is(anything, includingAlias = false) {
|
||||
return this.isBrowser(anything, includingAlias) || this.isOS(anything)
|
||||
|| this.isPlatform(anything);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -549,7 +552,7 @@ export default Parser;
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
@ -365,7 +365,7 @@ export default class Utils {
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jul 09 2020 22:10:18 GMT+0300 (Eastern European Summer Time) 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 Sat Sep 12 2020 11:21:13 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||||
</footer>
|
||||
|
||||
<script>prettyPrint();</script>
|
||||
|
87
index.d.ts
vendored
87
index.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/lancedikson/bowser
|
||||
// Definitions by: Alexander P. Cerutti <https://github.com/alexandercerutti>,
|
||||
|
||||
export = Bowser;
|
||||
export default Bowser;
|
||||
export as namespace Bowser;
|
||||
|
||||
declare namespace Bowser {
|
||||
@ -34,6 +34,14 @@ declare namespace Bowser {
|
||||
interface Parser {
|
||||
constructor(UA: string, skipParsing?: boolean): Parser.Parser;
|
||||
|
||||
/**
|
||||
* Check if the version is equals the browser version
|
||||
* @param version The string to compare with the browser version
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
compareVersion(version: string): boolean;
|
||||
|
||||
/**
|
||||
* Get parsed browser object
|
||||
* @return {BrowserDetails} Browser's details
|
||||
@ -54,7 +62,7 @@ declare namespace Bowser {
|
||||
* @return {String} version of browser
|
||||
*/
|
||||
|
||||
getBrowserVersion(): string;
|
||||
getBrowserVersion(): string | undefined;
|
||||
|
||||
/**
|
||||
* Get OS
|
||||
@ -105,6 +113,13 @@ declare namespace Bowser {
|
||||
|
||||
getEngine(): EngineDetails;
|
||||
|
||||
/**
|
||||
* Get parsed engine's name
|
||||
* @returns {String} Engine's name or an empty string
|
||||
*/
|
||||
|
||||
getEngineName(): string;
|
||||
|
||||
/**
|
||||
* Get parsed result
|
||||
* @return {ParsedResult}
|
||||
@ -123,16 +138,51 @@ declare namespace Bowser {
|
||||
* Is anything? Check if the browser is called "anything",
|
||||
* the OS called "anything" or the platform called "anything"
|
||||
* @param {String} anything
|
||||
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
is(anything: any): boolean;
|
||||
is(anything: any, includingAlias?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Check if the browser name equals the passed string
|
||||
* @param browserName The string to compare with the browser name
|
||||
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isBrowser(browserName: string, includingAlias?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Check if the engine name equals the passed string
|
||||
* @param engineName The string to compare with the engine name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isEngine(engineName: string): boolean;
|
||||
|
||||
/**
|
||||
* Check if the OS name equals the passed string
|
||||
* @param OSName The string to compare with the OS name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isOS(OSName: string): boolean;
|
||||
|
||||
/**
|
||||
* Check if the platform name equals the passed string
|
||||
* @param platformName The string to compare with the platform name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isPlatform(platformName: string): boolean;
|
||||
|
||||
/**
|
||||
* Parse full information about the browser
|
||||
* @returns {Parser.Parser}
|
||||
*/
|
||||
|
||||
parse(): void;
|
||||
parse(): Parser.Parser;
|
||||
|
||||
/**
|
||||
* Get parsed browser object
|
||||
@ -185,16 +235,39 @@ declare namespace Bowser {
|
||||
|
||||
/**
|
||||
* Check if the browser name equals the passed string
|
||||
* @param browserName The string to compare with the browser name
|
||||
* @param {string} browserName The string to compare with the browser name
|
||||
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
|
||||
isBrowser(browserName: string, includingAlias?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Check if any of the given values satifies `.is(anything)`
|
||||
* Check if the engine name equals the passed string
|
||||
* @param {string} engineName The string to compare with the engine name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isEngine(engineName: string): boolean;
|
||||
|
||||
/**
|
||||
* Check if the platform type equals the passed string
|
||||
* @param {string} platformType The string to compare with the platform type
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isPlatform(platformType: string): boolean;
|
||||
|
||||
/**
|
||||
* Check if the OS name equals the passed string
|
||||
* @param {string} osName The string to compare with the OS name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
isOS(osName: string): boolean;
|
||||
|
||||
/**
|
||||
* Check if any of the given values satisfies `.is(anything)`
|
||||
* @param {string[]} anythings
|
||||
* @returns {boolean} true if at least one condition is satisfied, false otherwise.
|
||||
*/
|
||||
|
632
package-lock.json
generated
632
package-lock.json
generated
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "bowser",
|
||||
"version": "2.10.0",
|
||||
"version": "2.11.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@babel/cli": {
|
||||
"version": "7.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.8.3.tgz",
|
||||
"integrity": "sha512-K2UXPZCKMv7KwWy9Bl4sa6+jTNP7JyDiHKzoOiUUygaEDbC60vaargZDnO9oFMvlq8pIKOOyUUgeMYrsaN9djA==",
|
||||
"version": "7.11.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.11.6.tgz",
|
||||
"integrity": "sha512-+w7BZCvkewSmaRM6H4L2QM3RL90teqEIHDIFXAmrW33+0jhlymnDAEdqVeCZATvxhQuio1ifoGVlJJbIiH9Ffg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chokidar": "^2.1.8",
|
||||
@ -15,7 +15,7 @@
|
||||
"convert-source-map": "^1.1.0",
|
||||
"fs-readdir-recursive": "^1.1.0",
|
||||
"glob": "^7.0.0",
|
||||
"lodash": "^4.17.13",
|
||||
"lodash": "^4.17.19",
|
||||
"make-dir": "^2.1.0",
|
||||
"slash": "^2.0.0",
|
||||
"source-map": "^0.5.0"
|
||||
@ -43,9 +43,9 @@
|
||||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz",
|
||||
"integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
|
||||
"integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
|
||||
"dev": true
|
||||
},
|
||||
"inherits": {
|
||||
@ -4383,6 +4383,16 @@
|
||||
"integrity": "sha1-SOyNFt9Dd+rl+liEaCSAr02Vx3Q=",
|
||||
"dev": true
|
||||
},
|
||||
"bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"blob": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",
|
||||
@ -5552,9 +5562,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"convert-source-map": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
|
||||
"integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==",
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
|
||||
"integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.1"
|
||||
@ -6133,9 +6143,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"elliptic": {
|
||||
"version": "6.5.1",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz",
|
||||
"integrity": "sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg==",
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
||||
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bn.js": "^4.4.0",
|
||||
@ -7257,6 +7267,13 @@
|
||||
"flat-cache": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"filename-reserved-regex": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz",
|
||||
@ -7647,551 +7664,14 @@
|
||||
"dev": true
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz",
|
||||
"integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==",
|
||||
"version": "1.2.13",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
||||
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "^2.9.2",
|
||||
"node-pre-gyp": "^0.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"abbrev": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"are-we-there-yet": {
|
||||
"version": "1.1.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"delegates": "^1.0.0",
|
||||
"readable-stream": "^2.0.6"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"chownr": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"deep-extend": {
|
||||
"version": "0.6.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"delegates": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"detect-libc": {
|
||||
"version": "1.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "1.2.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"gauge": {
|
||||
"version": "2.7.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"aproba": "^1.0.3",
|
||||
"console-control-strings": "^1.0.0",
|
||||
"has-unicode": "^2.0.0",
|
||||
"object-assign": "^4.1.0",
|
||||
"signal-exit": "^3.0.0",
|
||||
"string-width": "^1.0.1",
|
||||
"strip-ansi": "^3.0.1",
|
||||
"wide-align": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"has-unicode": {
|
||||
"version": "2.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"ignore-walk": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "1.2.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"needle": {
|
||||
"version": "2.2.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"debug": "^2.1.2",
|
||||
"iconv-lite": "^0.4.4",
|
||||
"sax": "^1.2.4"
|
||||
}
|
||||
},
|
||||
"node-pre-gyp": {
|
||||
"version": "0.10.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"detect-libc": "^1.0.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"needle": "^2.2.1",
|
||||
"nopt": "^4.0.1",
|
||||
"npm-packlist": "^1.1.6",
|
||||
"npmlog": "^4.0.2",
|
||||
"rc": "^1.2.7",
|
||||
"rimraf": "^2.6.1",
|
||||
"semver": "^5.3.0",
|
||||
"tar": "^4"
|
||||
}
|
||||
},
|
||||
"nopt": {
|
||||
"version": "4.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"abbrev": "1",
|
||||
"osenv": "^0.1.4"
|
||||
}
|
||||
},
|
||||
"npm-bundled": {
|
||||
"version": "1.0.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"npm-packlist": {
|
||||
"version": "1.2.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ignore-walk": "^3.0.1",
|
||||
"npm-bundled": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"npmlog": {
|
||||
"version": "4.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"are-we-there-yet": "~1.1.2",
|
||||
"console-control-strings": "~1.1.0",
|
||||
"gauge": "~2.7.3",
|
||||
"set-blocking": "~2.0.0"
|
||||
}
|
||||
},
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"os-homedir": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"osenv": {
|
||||
"version": "0.1.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"os-homedir": "^1.0.0",
|
||||
"os-tmpdir": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"rc": {
|
||||
"version": "1.2.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "~2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "2.6.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.6.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
"strip-ansi": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"tar": {
|
||||
"version": "4.4.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"chownr": "^1.1.1",
|
||||
"fs-minipass": "^1.2.5",
|
||||
"minipass": "^2.3.4",
|
||||
"minizlib": "^1.1.1",
|
||||
"mkdirp": "^0.5.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"string-width": "^1.0.2 || 2"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.12.1"
|
||||
}
|
||||
},
|
||||
"function-bind": {
|
||||
@ -8757,9 +8237,9 @@
|
||||
}
|
||||
},
|
||||
"http-proxy": {
|
||||
"version": "1.18.0",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz",
|
||||
"integrity": "sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==",
|
||||
"version": "1.18.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
||||
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"eventemitter3": "^4.0.0",
|
||||
@ -9955,9 +9435,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
||||
"version": "4.17.19",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
||||
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash._baseflatten": {
|
||||
@ -10584,9 +10064,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz",
|
||||
"integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==",
|
||||
"version": "2.14.1",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
@ -14623,9 +14103,9 @@
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "13.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
|
||||
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
|
||||
"version": "13.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
|
||||
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
@ -14904,10 +14384,8 @@
|
||||
}
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||
"dev": true
|
||||
"version": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
||||
},
|
||||
"cliui": {
|
||||
"version": "6.0.0",
|
||||
@ -15005,16 +14483,6 @@
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "16.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz",
|
||||
"integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"name": "bowser",
|
||||
"version": "2.10.0",
|
||||
"description": "Lightweight browser detector",
|
||||
"keywords": [
|
||||
"browser",
|
||||
@ -29,7 +28,7 @@
|
||||
"url": "git+https://github.com/lancedikson/bowser.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.8.3",
|
||||
"@babel/cli": "^7.11.6",
|
||||
"@babel/core": "^7.8.0",
|
||||
"@babel/polyfill": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.2",
|
||||
@ -72,7 +71,8 @@
|
||||
"generate-and-deploy-docs": "npm run generate-docs && gh-pages --dist docs --dest docs",
|
||||
"watch": "webpack --watch --config webpack.config.js",
|
||||
"prepublishOnly": "npm run build",
|
||||
"lint": "eslint ./src",
|
||||
"lint:check": "eslint ./src",
|
||||
"lint:fix": "eslint --fix ./src",
|
||||
"testem": "testem",
|
||||
"test": "nyc --reporter=html --reporter=text ava",
|
||||
"test:watch": "ava --watch",
|
||||
|
@ -22,6 +22,7 @@ export const BROWSER_ALIASES_MAP = {
|
||||
'NAVER Whale Browser': 'naver',
|
||||
Opera: 'opera',
|
||||
'Opera Coast': 'opera_coast',
|
||||
'Pale Moon': 'pale_moon',
|
||||
PhantomJS: 'phantomjs',
|
||||
Puffin: 'puffin',
|
||||
QupZilla: 'qupzilla',
|
||||
@ -64,6 +65,7 @@ export const BROWSER_MAP = {
|
||||
naver: 'NAVER Whale Browser',
|
||||
opera: 'Opera',
|
||||
opera_coast: 'Opera Coast',
|
||||
pale_moon: 'Pale Moon',
|
||||
phantomjs: 'PhantomJS',
|
||||
puffin: 'Puffin',
|
||||
qupzilla: 'QupZilla',
|
||||
@ -88,6 +90,7 @@ export const PLATFORMS_MAP = {
|
||||
mobile: 'mobile',
|
||||
desktop: 'desktop',
|
||||
tv: 'tv',
|
||||
bot: 'bot',
|
||||
};
|
||||
|
||||
export const OS_MAP = {
|
||||
|
@ -108,6 +108,21 @@ const browsersList = [
|
||||
return browser;
|
||||
},
|
||||
},
|
||||
{
|
||||
test: [/PaleMoon/i],
|
||||
describe(ua) {
|
||||
const browser = {
|
||||
name: 'Pale Moon',
|
||||
};
|
||||
const version = Utils.getFirstMatch(commonVersionIdentifier, ua) || Utils.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i, ua);
|
||||
|
||||
if (version) {
|
||||
browser.version = version;
|
||||
}
|
||||
|
||||
return browser;
|
||||
},
|
||||
},
|
||||
{
|
||||
test: [/MZBrowser/i],
|
||||
describe(ua) {
|
||||
@ -561,6 +576,21 @@ const browsersList = [
|
||||
return browser;
|
||||
},
|
||||
},
|
||||
{
|
||||
test: [/MiuiBrowser/i],
|
||||
describe(ua) {
|
||||
const browser = {
|
||||
name: 'Miui',
|
||||
};
|
||||
const version = Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
|
||||
|
||||
if (version) {
|
||||
browser.version = version;
|
||||
}
|
||||
|
||||
return browser;
|
||||
},
|
||||
},
|
||||
{
|
||||
test: [/chromium/i],
|
||||
describe(ua) {
|
||||
|
@ -12,7 +12,7 @@ export default [
|
||||
test: [/googlebot/i],
|
||||
describe() {
|
||||
return {
|
||||
type: 'bot',
|
||||
type: PLATFORMS_MAP.bot,
|
||||
vendor: 'Google',
|
||||
};
|
||||
},
|
||||
@ -130,6 +130,22 @@ export default [
|
||||
},
|
||||
},
|
||||
|
||||
/* Nokia */
|
||||
{
|
||||
test: [/Nokia/i],
|
||||
describe(ua) {
|
||||
const model = Utils.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i, ua);
|
||||
const platform = {
|
||||
type: PLATFORMS_MAP.mobile,
|
||||
vendor: 'Nokia',
|
||||
};
|
||||
if (model) {
|
||||
platform.model = model;
|
||||
}
|
||||
return platform;
|
||||
},
|
||||
},
|
||||
|
||||
/* Mobile */
|
||||
{
|
||||
test: [/[^-]mobi/i],
|
||||
|
@ -87,7 +87,7 @@ class Parser {
|
||||
return _browser.test(this);
|
||||
}
|
||||
|
||||
if (_browser.test instanceof Array) {
|
||||
if (Array.isArray(_browser.test)) {
|
||||
return _browser.test.some(condition => this.test(condition));
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ class Parser {
|
||||
return _os.test(this);
|
||||
}
|
||||
|
||||
if (_os.test instanceof Array) {
|
||||
if (Array.isArray(_os.test)) {
|
||||
return _os.test.some(condition => this.test(condition));
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ class Parser {
|
||||
return _platform.test(this);
|
||||
}
|
||||
|
||||
if (_platform.test instanceof Array) {
|
||||
if (Array.isArray(_platform.test)) {
|
||||
return _platform.test.some(condition => this.test(condition));
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ class Parser {
|
||||
return _engine.test(this);
|
||||
}
|
||||
|
||||
if (_engine.test instanceof Array) {
|
||||
if (Array.isArray(_engine.test)) {
|
||||
return _engine.test.some(condition => this.test(condition));
|
||||
}
|
||||
|
||||
@ -313,6 +313,7 @@ class Parser {
|
||||
|
||||
/**
|
||||
* Parse full information about the browser
|
||||
* @returns {Parser}
|
||||
*/
|
||||
parse() {
|
||||
this.parseBrowser();
|
||||
@ -407,7 +408,7 @@ class Parser {
|
||||
|
||||
/**
|
||||
* Check if the browser name equals the passed string
|
||||
* @param browserName The string to compare with the browser name
|
||||
* @param {string} browserName The string to compare with the browser name
|
||||
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||
* @returns {boolean}
|
||||
*/
|
||||
@ -458,14 +459,29 @@ class Parser {
|
||||
) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the OS name equals the passed string
|
||||
* @param {string} osName The string to compare with the OS name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isOS(osName) {
|
||||
return this.getOSName(true) === String(osName).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the platform type equals the passed string
|
||||
* @param {string} platformType The string to compare with the platform type
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isPlatform(platformType) {
|
||||
return this.getPlatformType(true) === String(platformType).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the engine name equals the passed string
|
||||
* @param {string} engineName The string to compare with the engine name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isEngine(engineName) {
|
||||
return this.getEngineName(true) === String(engineName).toLowerCase();
|
||||
}
|
||||
@ -474,10 +490,12 @@ class Parser {
|
||||
* Is anything? Check if the browser is called "anything",
|
||||
* the OS called "anything" or the platform called "anything"
|
||||
* @param {String} anything
|
||||
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
is(anything) {
|
||||
return this.isBrowser(anything) || this.isOS(anything) || this.isPlatform(anything);
|
||||
is(anything, includingAlias = false) {
|
||||
return this.isBrowser(anything, includingAlias) || this.isOS(anything)
|
||||
|| this.isPlatform(anything);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,10 +295,10 @@ export default class Utils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get short version/alias for a browser name
|
||||
* Get browser name for a short version/alias
|
||||
*
|
||||
* @example
|
||||
* getBrowserAlias('edge') // Microsoft Edge
|
||||
* getBrowserTypeByAlias('edge') // Microsoft Edge
|
||||
*
|
||||
* @param {string} browserAlias
|
||||
* @return {string}
|
||||
|
@ -336,6 +336,35 @@
|
||||
type: "tv"
|
||||
engine:
|
||||
name: "Blink"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; Android 9; Nokia 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Mobile Safari/537.36"
|
||||
spec:
|
||||
browser:
|
||||
name: "Chrome"
|
||||
version: "85.0.4183.127"
|
||||
os:
|
||||
name: "Android"
|
||||
version: "9"
|
||||
versionName: "Pie"
|
||||
platform:
|
||||
type: "mobile"
|
||||
vendor: "Nokia"
|
||||
model: "5.1"
|
||||
engine:
|
||||
name: "Blink"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; Android 10; SM-G970F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3396.81 Mobile Safari/537.36"
|
||||
spec:
|
||||
browser:
|
||||
name: "Chrome"
|
||||
version: "75.0.3396.81"
|
||||
os:
|
||||
name: "Android"
|
||||
version: "10"
|
||||
platform:
|
||||
type: "mobile"
|
||||
engine:
|
||||
name: "Blink"
|
||||
Google Search:
|
||||
-
|
||||
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/83.0.268992909 Mobile/15E148 Safari/605.1"
|
||||
@ -1391,6 +1420,7 @@
|
||||
version: "8.0"
|
||||
platform:
|
||||
type: "mobile"
|
||||
vendor: "Nokia"
|
||||
engine:
|
||||
name: "Trident"
|
||||
version: "6.0"
|
||||
@ -1405,6 +1435,7 @@
|
||||
version: "8.0"
|
||||
platform:
|
||||
type: "mobile"
|
||||
vendor: "Nokia"
|
||||
engine:
|
||||
name: "Trident"
|
||||
version: "6.0"
|
||||
@ -1433,6 +1464,7 @@
|
||||
version: "7.0"
|
||||
platform:
|
||||
type: "mobile"
|
||||
vendor: "Nokia"
|
||||
engine:
|
||||
name: "Trident"
|
||||
version: "3.1"
|
||||
@ -3026,3 +3058,60 @@
|
||||
type: "desktop"
|
||||
engine:
|
||||
name: "Blink"
|
||||
Miui:
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; U; Android 9; fr-fr; Redmi Note 8 Pro Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/11.9.3-"
|
||||
spec:
|
||||
browser:
|
||||
name: "Miui"
|
||||
version: "11.9.3"
|
||||
os:
|
||||
name: "Android"
|
||||
version: "9"
|
||||
versionName: "Pie"
|
||||
platform:
|
||||
type: "mobile"
|
||||
engine:
|
||||
name: "Blink"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; U; Android 9; fr-fr; Redmi Note 8 Pro Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser"
|
||||
spec:
|
||||
browser:
|
||||
name: "Miui"
|
||||
os:
|
||||
name: "Android"
|
||||
version: "9"
|
||||
versionName: "Pie"
|
||||
platform:
|
||||
type: "mobile"
|
||||
engine:
|
||||
name: "Blink"
|
||||
Pale Moon:
|
||||
-
|
||||
ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Goanna/4.8 Firefox/68.0 PaleMoon/29.1.1"
|
||||
spec:
|
||||
browser:
|
||||
name: "Pale Moon"
|
||||
version: "29.1.1"
|
||||
os:
|
||||
name: "Windows"
|
||||
version: "NT 10.0"
|
||||
versionName: "10"
|
||||
platform:
|
||||
type: "desktop"
|
||||
engine:
|
||||
name: "Gecko"
|
||||
version: "20100101"
|
||||
-
|
||||
ua: "Mozilla/5.0 (X11; Linux i686; rv:45.9) Gecko/20100101 Goanna/3.2 Firefox/45.9 PaleMoon/27.2.0"
|
||||
spec:
|
||||
browser:
|
||||
name: "Pale Moon"
|
||||
version: "27.2.0"
|
||||
os:
|
||||
name: "Linux"
|
||||
platform:
|
||||
type: "desktop"
|
||||
engine:
|
||||
name: "Gecko"
|
||||
version: "20100101"
|
||||
|
@ -165,6 +165,30 @@ test('Parser.is should pass', (t) => {
|
||||
t.is(parser.is('macos'), true);
|
||||
});
|
||||
|
||||
test('Parser.is should pass when not including aliases', (t) => {
|
||||
t.is(edgeParser.is('Microsoft Edge', false), true);
|
||||
t.is(edgeParser.is('microsoft edge', false), true);
|
||||
t.is(edgeParser.is('mIcrosoft eDge', false), true);
|
||||
t.is(edgeParser.is('edge', false), false);
|
||||
t.is(edgeParser.is('Edge', false), false);
|
||||
t.is(edgeParser.is('desktop', false), false);
|
||||
t.is(edgeParser.is('macos', false), false);
|
||||
t.is(edgeParser.is('mobile', false), true);
|
||||
t.is(edgeParser.is('android', false), true);
|
||||
});
|
||||
|
||||
test('Parser.is should pass when including aliases', (t) => {
|
||||
t.is(edgeParser.is('Microsoft Edge', true), true);
|
||||
t.is(edgeParser.is('microsoft edge', true), true);
|
||||
t.is(edgeParser.is('mIcrosoft eDge', true), true);
|
||||
t.is(edgeParser.is('edge', true), true);
|
||||
t.is(edgeParser.is('Edge', true), true);
|
||||
t.is(edgeParser.is('desktop', true), false);
|
||||
t.is(edgeParser.is('macos', true), false);
|
||||
t.is(edgeParser.is('mobile', true), true);
|
||||
t.is(edgeParser.is('android', true), 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);
|
||||
@ -199,3 +223,8 @@ test('Parser.isBrowser should pass for non-aliased browsers', (t) => {
|
||||
t.is(focusParser.isBrowser('Focus', true), true);
|
||||
t.is(focusParser.isBrowser('Focus', false), true);
|
||||
});
|
||||
|
||||
test('Parser.isEngine should pass', (t) => {
|
||||
t.is(parser.isEngine('blink'), true);
|
||||
t.is(parser.isEngine('webkit'), false);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user