mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8c489bd98b | ||
|
5bab4ee97d | ||
|
16c9f22546 | ||
|
327e6f5e51 | ||
|
0626bf8c8c | ||
|
94ab87ec0e | ||
|
07462efb6a | ||
|
f8fcea59e7 | ||
|
4481f5aab3 | ||
|
0c7380dbf9 | ||
|
bb8f94efcd | ||
|
29222b2fcf | ||
|
69bc6c2dbf | ||
|
9c1588a43e | ||
|
fefa53ad95 | ||
|
efb8e612a5 | ||
|
b86bce16af | ||
|
f09411489c |
@ -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
|
|
@ -3,7 +3,7 @@
|
|||||||
### 2.11.0 (Sep 12, 2020)
|
### 2.11.0 (Sep 12, 2020)
|
||||||
- [ADD] Added support for aliases in `Parser#is` method (#437)
|
- [ADD] Added support for aliases in `Parser#is` method (#437)
|
||||||
- [ADD] Added more typings (#438, #427)
|
- [ADD] Added more typings (#438, #427)
|
||||||
- [ADD] Added support for MIUI Browserr (#436)
|
- [ADD] Added support for MIUI Browser (#436)
|
||||||
|
|
||||||
### 2.10.0 (Jul 9, 2020)
|
### 2.10.0 (Jul 9, 2020)
|
||||||
- [FIX] Fix for Firefox detection on iOS 13 [#415]
|
- [FIX] Fix for Firefox detection on iOS 13 [#415]
|
||||||
|
@ -11,8 +11,6 @@ Don't hesitate to support the project on Github or [OpenCollective](https://open
|
|||||||
# Contents
|
# Contents
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Use cases](#use-cases)
|
- [Use cases](#use-cases)
|
||||||
- [Advanced usage](#advanced-usage)
|
|
||||||
- [How can I help?](#contributing)
|
|
||||||
|
|
||||||
# Overview
|
# 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 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`._
|
_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
|
### 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>
|
<a href="https://github.com/lancedikson/bowser/graphs/contributors"><img src="https://opencollective.com/bowser/contributors.svg?width=890&button=false" /></a>
|
||||||
|
|
||||||
### Financial Contributors
|
### Financial Contributors
|
||||||
|
79
index.d.ts
vendored
79
index.d.ts
vendored
@ -2,7 +2,7 @@
|
|||||||
// Project: https://github.com/lancedikson/bowser
|
// Project: https://github.com/lancedikson/bowser
|
||||||
// Definitions by: Alexander P. Cerutti <https://github.com/alexandercerutti>,
|
// Definitions by: Alexander P. Cerutti <https://github.com/alexandercerutti>,
|
||||||
|
|
||||||
export = Bowser;
|
export default Bowser;
|
||||||
export as namespace Bowser;
|
export as namespace Bowser;
|
||||||
|
|
||||||
declare namespace Bowser {
|
declare namespace Bowser {
|
||||||
@ -34,6 +34,14 @@ declare namespace Bowser {
|
|||||||
interface Parser {
|
interface Parser {
|
||||||
constructor(UA: string, skipParsing?: boolean): Parser.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
|
* Get parsed browser object
|
||||||
* @return {BrowserDetails} Browser's details
|
* @return {BrowserDetails} Browser's details
|
||||||
@ -54,7 +62,7 @@ declare namespace Bowser {
|
|||||||
* @return {String} version of browser
|
* @return {String} version of browser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
getBrowserVersion(): string;
|
getBrowserVersion(): string | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get OS
|
* Get OS
|
||||||
@ -130,10 +138,44 @@ declare namespace Bowser {
|
|||||||
* 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"
|
||||||
* @param {String} anything
|
* @param {String} anything
|
||||||
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||||
* @returns {Boolean}
|
* @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
|
* Parse full information about the browser
|
||||||
@ -191,18 +233,41 @@ declare namespace Bowser {
|
|||||||
|
|
||||||
satisfies(checkTree: checkTree): boolean | undefined;
|
satisfies(checkTree: checkTree): boolean | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the browser name equals the passed string
|
* 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
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
isBrowser(browserName: string, includingAlias?: boolean): 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
|
* @param {string[]} anythings
|
||||||
* @returns {boolean} true if at least one condition is satisfied, false otherwise.
|
* @returns {boolean} true if at least one condition is satisfied, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "bowser",
|
"name": "bowser",
|
||||||
"version": "2.11.0",
|
|
||||||
"description": "Lightweight browser detector",
|
"description": "Lightweight browser detector",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"browser",
|
"browser",
|
||||||
@ -72,7 +71,8 @@
|
|||||||
"generate-and-deploy-docs": "npm run generate-docs && gh-pages --dist docs --dest docs",
|
"generate-and-deploy-docs": "npm run generate-docs && gh-pages --dist docs --dest docs",
|
||||||
"watch": "webpack --watch --config webpack.config.js",
|
"watch": "webpack --watch --config webpack.config.js",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"lint": "eslint ./src",
|
"lint:check": "eslint ./src",
|
||||||
|
"lint:fix": "eslint --fix ./src",
|
||||||
"testem": "testem",
|
"testem": "testem",
|
||||||
"test": "nyc --reporter=html --reporter=text ava",
|
"test": "nyc --reporter=html --reporter=text ava",
|
||||||
"test:watch": "ava --watch",
|
"test:watch": "ava --watch",
|
||||||
|
@ -22,6 +22,7 @@ export const BROWSER_ALIASES_MAP = {
|
|||||||
'NAVER Whale Browser': 'naver',
|
'NAVER Whale Browser': 'naver',
|
||||||
Opera: 'opera',
|
Opera: 'opera',
|
||||||
'Opera Coast': 'opera_coast',
|
'Opera Coast': 'opera_coast',
|
||||||
|
'Pale Moon': 'pale_moon',
|
||||||
PhantomJS: 'phantomjs',
|
PhantomJS: 'phantomjs',
|
||||||
Puffin: 'puffin',
|
Puffin: 'puffin',
|
||||||
QupZilla: 'qupzilla',
|
QupZilla: 'qupzilla',
|
||||||
@ -64,6 +65,7 @@ export const BROWSER_MAP = {
|
|||||||
naver: 'NAVER Whale Browser',
|
naver: 'NAVER Whale Browser',
|
||||||
opera: 'Opera',
|
opera: 'Opera',
|
||||||
opera_coast: 'Opera Coast',
|
opera_coast: 'Opera Coast',
|
||||||
|
pale_moon: 'Pale Moon',
|
||||||
phantomjs: 'PhantomJS',
|
phantomjs: 'PhantomJS',
|
||||||
puffin: 'Puffin',
|
puffin: 'Puffin',
|
||||||
qupzilla: 'QupZilla',
|
qupzilla: 'QupZilla',
|
||||||
@ -88,6 +90,7 @@ export const PLATFORMS_MAP = {
|
|||||||
mobile: 'mobile',
|
mobile: 'mobile',
|
||||||
desktop: 'desktop',
|
desktop: 'desktop',
|
||||||
tv: 'tv',
|
tv: 'tv',
|
||||||
|
bot: 'bot',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const OS_MAP = {
|
export const OS_MAP = {
|
||||||
|
@ -108,6 +108,21 @@ const browsersList = [
|
|||||||
return browser;
|
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],
|
test: [/MZBrowser/i],
|
||||||
describe(ua) {
|
describe(ua) {
|
||||||
|
@ -12,7 +12,7 @@ export default [
|
|||||||
test: [/googlebot/i],
|
test: [/googlebot/i],
|
||||||
describe() {
|
describe() {
|
||||||
return {
|
return {
|
||||||
type: 'bot',
|
type: PLATFORMS_MAP.bot,
|
||||||
vendor: 'Google',
|
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 */
|
/* Mobile */
|
||||||
{
|
{
|
||||||
test: [/[^-]mobi/i],
|
test: [/[^-]mobi/i],
|
||||||
|
@ -87,7 +87,7 @@ class Parser {
|
|||||||
return _browser.test(this);
|
return _browser.test(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_browser.test instanceof Array) {
|
if (Array.isArray(_browser.test)) {
|
||||||
return _browser.test.some(condition => this.test(condition));
|
return _browser.test.some(condition => this.test(condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class Parser {
|
|||||||
return _os.test(this);
|
return _os.test(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_os.test instanceof Array) {
|
if (Array.isArray(_os.test)) {
|
||||||
return _os.test.some(condition => this.test(condition));
|
return _os.test.some(condition => this.test(condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ class Parser {
|
|||||||
return _platform.test(this);
|
return _platform.test(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_platform.test instanceof Array) {
|
if (Array.isArray(_platform.test)) {
|
||||||
return _platform.test.some(condition => this.test(condition));
|
return _platform.test.some(condition => this.test(condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ class Parser {
|
|||||||
return _engine.test(this);
|
return _engine.test(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_engine.test instanceof Array) {
|
if (Array.isArray(_engine.test)) {
|
||||||
return _engine.test.some(condition => this.test(condition));
|
return _engine.test.some(condition => this.test(condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ class Parser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the browser name equals the passed string
|
* 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
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
@ -459,14 +459,29 @@ class Parser {
|
|||||||
) > -1;
|
) > -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) {
|
isOS(osName) {
|
||||||
return this.getOSName(true) === String(osName).toLowerCase();
|
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) {
|
isPlatform(platformType) {
|
||||||
return this.getPlatformType(true) === String(platformType).toLowerCase();
|
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) {
|
isEngine(engineName) {
|
||||||
return this.getEngineName(true) === String(engineName).toLowerCase();
|
return this.getEngineName(true) === String(engineName).toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -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
|
* @example
|
||||||
* getBrowserAlias('edge') // Microsoft Edge
|
* getBrowserTypeByAlias('edge') // Microsoft Edge
|
||||||
*
|
*
|
||||||
* @param {string} browserAlias
|
* @param {string} browserAlias
|
||||||
* @return {string}
|
* @return {string}
|
||||||
|
@ -336,6 +336,35 @@
|
|||||||
type: "tv"
|
type: "tv"
|
||||||
engine:
|
engine:
|
||||||
name: "Blink"
|
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:
|
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"
|
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"
|
version: "8.0"
|
||||||
platform:
|
platform:
|
||||||
type: "mobile"
|
type: "mobile"
|
||||||
|
vendor: "Nokia"
|
||||||
engine:
|
engine:
|
||||||
name: "Trident"
|
name: "Trident"
|
||||||
version: "6.0"
|
version: "6.0"
|
||||||
@ -1405,6 +1435,7 @@
|
|||||||
version: "8.0"
|
version: "8.0"
|
||||||
platform:
|
platform:
|
||||||
type: "mobile"
|
type: "mobile"
|
||||||
|
vendor: "Nokia"
|
||||||
engine:
|
engine:
|
||||||
name: "Trident"
|
name: "Trident"
|
||||||
version: "6.0"
|
version: "6.0"
|
||||||
@ -1433,6 +1464,7 @@
|
|||||||
version: "7.0"
|
version: "7.0"
|
||||||
platform:
|
platform:
|
||||||
type: "mobile"
|
type: "mobile"
|
||||||
|
vendor: "Nokia"
|
||||||
engine:
|
engine:
|
||||||
name: "Trident"
|
name: "Trident"
|
||||||
version: "3.1"
|
version: "3.1"
|
||||||
@ -3054,3 +3086,32 @@
|
|||||||
type: "mobile"
|
type: "mobile"
|
||||||
engine:
|
engine:
|
||||||
name: "Blink"
|
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"
|
||||||
|
Loading…
Reference in New Issue
Block a user