1
0
mirror of https://github.com/lancedikson/bowser synced 2026-01-20 15:50:21 +00:00

Compare commits

..

No commits in common. "master" and "2.5.1" have entirely different histories.

34 changed files with 3116 additions and 8561 deletions

View File

@ -1,7 +1,7 @@
{
"presets": [["@babel/preset-env", {
"useBuiltIns": "entry",
"modules": "cjs",
"modules": "auto",
"loose": true,
"targets": {
"ie": "8",

View File

@ -1 +1 @@
repo_token: Ba2bS7pOlSLZWuESBnff8qxDjIS8Mg1Z0

View File

@ -1,129 +0,0 @@
# Copilot Instructions for Bowser
## Project Overview
Bowser is a small, fast, and rich-API browser/platform/engine detector for both browser and Node.js environments. It's designed to parse User-Agent strings and provide detailed information about browsers, operating systems, platforms, and rendering engines.
## Architecture
### Core Components
- **`src/bowser.js`**: Main entry point and public API. Provides static methods `getParser()` and `parse()`.
- **`src/parser.js`**: Core parsing engine that orchestrates all parsers and returns structured results.
- **`src/parser-browsers.js`**: Browser detection logic using regex patterns.
- **`src/parser-os.js`**: Operating system detection logic.
- **`src/parser-platforms.js`**: Platform type detection (desktop, tablet, mobile).
- **`src/parser-engines.js`**: Rendering engine detection (WebKit, Blink, Gecko, etc.).
- **`src/constants.js`**: Centralized constants including browser aliases and mappings.
- **`src/utils.js`**: Utility functions for string matching and manipulation.
### Build Output
- **`es5.js`**: ES5 transpiled version (default export).
- **`bundled.js`**: ES5 version with babel-polyfill included.
## Development Workflow
### Setup
```bash
npm install
```
### Key Commands
- **Build**: `npm run build` - Compiles source files using Webpack and Babel.
- **Test**: `npm test` - Runs unit and acceptance tests using AVA.
- **Lint**: `npm run lint:check` - Checks code style using ESLint.
- **Lint Fix**: `npm run lint:fix` - Auto-fixes linting issues.
- **Watch Mode**: `npm run watch` - Builds on file changes.
- **Test Watch**: `npm run test:watch` - Runs tests on file changes.
### Testing
- Tests are located in `test/acceptance/` and `test/unit/`.
- Acceptance tests use real User-Agent strings from `test/acceptance/useragentstrings.yml`.
- Always update `useragentstrings.yml` when adding browser support.
- Test framework: AVA with Babel integration.
## Coding Standards
### Style Guide
- **ESLint Config**: Based on Airbnb Base style guide.
- **Parser**: Uses `babel-eslint`.
- **Exceptions**:
- Underscore-dangle allowed for private properties.
- `no-void` disabled.
- ES6 imports must include `.js` extension.
### Naming Conventions
- **Browser Aliases**: Use lowercase letters, replace spaces/dashes with underscores, drop "browser" suffix.
- Examples: `Opera Coast``opera_coast`, `UC Browser``uc`, `SeaMonkey``seamonkey`.
- **Private Properties**: Prefix with underscore (e.g., `_ua`).
- **Constants**: Use `UPPER_SNAKE_CASE` for constant maps and aliases.
### Code Patterns
- Use ES6 modules with explicit `.js` extensions.
- Prefer static methods in Bowser class.
- Use class-based structure for Parser.
- Regex patterns should be well-documented and tested.
- Keep parsers modular and focused on single responsibility.
## Adding Browser Support
When adding support for a new browser:
1. Add regex pattern to `src/parser-browsers.js`.
2. Add browser name to `BROWSER_ALIASES_MAP` in `src/constants.js`.
3. Add corresponding entry to `BROWSER_MAP`.
4. Add test cases to `test/acceptance/useragentstrings.yml`.
5. Run tests to verify: `npm test`.
6. Check for duplicates before adding aliases.
## Branching Strategy
- **`master`**: Development branch.
- **`production`**: Production branch.
- **New Features**: Branch from `master`, PR back to `master`.
- **Hot-fixes/Browser Support**: Branch from `production`, PR back to `production`.
## Important Files
- **`index.d.ts`**: TypeScript definitions.
- **`.babelrc`**: Babel configuration for ES5 transpilation.
- **`webpack.config.js`**: Build configuration.
- **`.eslintrc.yml`**: Linting rules.
- **`package.json`**: Dependencies and scripts.
## API Design Principles
- Keep the API simple and intuitive.
- Bowser class should be stateless and provide factory methods.
- Parser class handles instance-specific logic.
- Results should be structured and predictable.
- Support both immediate parsing and lazy parsing.
## Performance Considerations
- Parsers use lazy evaluation where possible.
- Regex patterns are optimized for common browsers first.
- Optional `skipParsing` parameter for delayed parsing.
- Minimal bundle size is a priority (~4.8kB gzipped).
## Documentation
- Use JSDoc comments for all public APIs.
- Document parameters, return types, and provide examples.
- Update README.md for API changes.
- Generate docs with: `npm run generate-docs`.
## Common Pitfalls
- Always check `BROWSER_ALIASES_MAP` for existing aliases before adding new ones.
- User-Agent strings can be complex; test edge cases thoroughly.
- Remember to update both the alias map and the reverse map in constants.
- Browser versions should be treated as strings, not numbers.
- Keep regex patterns readable with comments explaining their purpose.

View File

@ -1,19 +0,0 @@
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

View File

@ -1,20 +0,0 @@
name: 📝 Draft or update next release
concurrency: draft_or_update_next_release
on:
push:
branches:
- master
workflow_dispatch:
jobs:
prepare-deployment:
name: 📝 Draft or update next release
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,38 +0,0 @@
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@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i -g nyc@15
- 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 }}

View File

@ -1,63 +0,0 @@
name: Release
on:
# This job runs when a new release is published
release:
types: [published]
# Manual trigger with version input
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., 2.12.1)"
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 12.16.3
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
# Store the release version (from release tag or manual input)
- name: Set release version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "Manual release triggered for version: ${{ github.event.inputs.version }}"
else
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "Release triggered from tag: ${GITHUB_REF#refs/*/}"
fi
- run: npm ci
- run: npm version $RELEASE_VERSION --no-git-tag-version
- run: npm run build
- name: Publish to npm with retry
run: |
max_attempts=5
attempt=1
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt of $max_attempts..."
if npm publish --access public; then
echo "Successfully published!"
break
else
if [ $attempt -eq $max_attempts ]; then
echo "Failed to publish after $max_attempts attempts"
exit 1
fi
echo "Publish failed, waiting before retry..."
sleep_time=$((attempt * 30))
echo "Waiting ${sleep_time} seconds before retry..."
sleep $sleep_time
attempt=$((attempt + 1))
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.BOWSER_NPM_PUBLISH_TOKEN }}

View File

@ -1,44 +0,0 @@
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@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up node
uses: actions/setup-node@v4
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@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: "16"
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint:check

View File

@ -3,8 +3,3 @@ test
coverage
**/.*
node_modules
.github
docs
*.gz
jsdoc.json
webpack.config.js

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: node_js
after_success: npm run coverage
node_js:
- "12"
script:
- npm run lint
- npm run build
- npm test

View File

@ -1,49 +1,5 @@
# 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]
- [FIX] Updated development dependencies
### 2.9.0 (Jan 28, 2020)
- [ADD] Export more methods and constants via .d.ts [#388], [#390]
### 2.8.1 (Dec 26, 2019)
- [FIX] Reverted [#382] as it broke build
### 2.8.0 (Dec 26, 2019)
- [ADD] Add polyfills for Array.find & Object.assign [#383]
- [ADD] Export constants with types.d.ts [#382]
- [FIX] Add support for WeChat on Windows [#381]
- [FIX] Fix detection of Firefox on iPad [#379]
- [FIX] Add detection of Electron [#375]
- [FIX] Updated dev-dependencies
### 2.7.0 (Oct 2, 2019)
- [FIX] Add support for QQ Browser [#362]
- [FIX] Add support for GSA [#364]
- [FIX] Updated dependencies
### 2.6.0 (Sep 6, 2019)
- [ADD] Define "module" export in package.json [#354]
- [FIX] Fix Tablet PC detection [#334]
### 2.5.4 (Sep 2, 2019)
- [FIX] Exclude docs from the npm package [#349]
### 2.5.3 (Aug 4, 2019)
- [FIX] Add MacOS names support [#338]
- [FIX] Point typings.d.ts from package.json [#341]
- [FIX] Upgrade dependencies
### 2.5.2 (July 17, 2019)
- [FIX] Fixes the bug undefined method because of failed build (#335)
### 2.5.1 (July 17, 2019)
- [FIX] Fixes the bug with a custom Error class (#335)
- [FIX] Fixes the settings for Babel to reduce the bundle size (#259)

View File

@ -6,21 +6,23 @@ A small, fast and rich-API browser/platform/engine detector for both browser and
Don't hesitate to support the project on Github or [OpenCollective](https://opencollective.com/bowser) if you like it ❤️ Also, contributors are always welcome!
[![Financial Contributors on Open Collective](https://opencollective.com/bowser/all/badge.svg?label=financial+contributors)](https://opencollective.com/bowser) [![Build Status](https://travis-ci.org/bowser-js/bowser.svg?branch=master)](https://travis-ci.org/bowser-js/bowser/) [![Greenkeeper badge](https://badges.greenkeeper.io/bowser-js/bowser.svg)](https://greenkeeper.io/) [![Coverage Status](https://coveralls.io/repos/github/bowser-js/bowser/badge.svg?branch=master)](https://coveralls.io/github/bowser-js/bowser?branch=master) ![Downloads](https://img.shields.io/npm/dm/bowser)
[![Build Status](https://travis-ci.org/lancedikson/bowser.svg?branch=master)](https://travis-ci.org/lancedikson/bowser/) [![Greenkeeper badge](https://badges.greenkeeper.io/lancedikson/bowser.svg)](https://greenkeeper.io/) [![Coverage Status](https://coveralls.io/repos/github/lancedikson/bowser/badge.svg?branch=master)](https://coveralls.io/github/lancedikson/bowser?branch=master)
# Contents
- [Overview](#overview)
- [Use cases](#use-cases)
- [Advanced usage](#advanced-usage)
- [How can I help?](#contributing)
# Overview
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. Check it out on this page: https://bowser-js.github.io/bowser-online/.
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.
### ⚠️ Version 2.0 breaking changes ⚠️
Version 2.0 has drastically changed the API. All available methods are on the [docs page](https://bowser-js.github.io/bowser/docs/).
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/bowser-js/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
@ -118,13 +120,13 @@ const isValidBrowser = browser.satisfies({
// or in general
chrome: "~20.1.1432",
firefox: ">31",
opera: ">=22",
opera: ">=22"
// also supports equality operator
chrome: "=20.1.1432", // will match particular build only
// and loose-equality operator
chrome: "~20", // will match any 20.* sub-version
chrome: "~20" // will match any 20.* sub-version
chrome: "~20.1" // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
});
```
@ -143,35 +145,5 @@ list of aliases can be found in [the file](src/constants.js).
## Similar Projects
* [Kong](https://github.com/BigBadBleuCheese/Kong) - A C# port of Bowser.
## Contributors
### Code Contributors
This project exists thanks to all the people who contribute. [[Contribute](.github/CONTRIBUTING.md)].
<a href="https://github.com/bowser-js/bowser/graphs/contributors"><img src="https://opencollective.com/bowser/contributors.svg?width=890&button=false" /></a>
### Financial Contributors
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/bowser/contribute)]
#### Individuals
<a href="https://opencollective.com/bowser"><img src="https://opencollective.com/bowser/individuals.svg?width=890"></a>
#### Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/bowser/contribute)]
<a href="https://opencollective.com/bowser/organization/0/website"><img src="https://opencollective.com/bowser/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/1/website"><img src="https://opencollective.com/bowser/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/2/website"><img src="https://opencollective.com/bowser/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/3/website"><img src="https://opencollective.com/bowser/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/4/website"><img src="https://opencollective.com/bowser/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/5/website"><img src="https://opencollective.com/bowser/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/6/website"><img src="https://opencollective.com/bowser/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/7/website"><img src="https://opencollective.com/bowser/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/8/website"><img src="https://opencollective.com/bowser/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/9/website"><img src="https://opencollective.com/bowser/organization/9/avatar.svg"></a>
## License
Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -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 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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -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#line331">line 331</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line330">line 330</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, includingAlias<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<h4 class="name" id="is"><span class="type-signature"></span>is<span class="signature">(anything)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
@ -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#line481">line 481</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line476">line 476</a>
</li></ul></dd>
@ -1779,12 +1779,8 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
@ -1808,59 +1804,13 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
</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">
&lt;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>
@ -1917,7 +1867,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<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#line415">line 415</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line411">line 411</a>
</li></ul></dd>
@ -2104,7 +2054,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Parser.html">Parser</a>}</span></h4>
<h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">()</span><span class="type-signature"></span></h4>
@ -2116,7 +2066,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<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#line318">line 318</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line317">line 317</a>
</li></ul></dd>
@ -2183,24 +2133,6 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Parser.html">Parser</a></span>
</dd>
</dl>
@ -2644,7 +2576,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<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#line353">line 353</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line352">line 352</a>
</li></ul></dd>
@ -2818,7 +2750,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#line491">line 491</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line485">line 485</a>
</li></ul></dd>
@ -3129,7 +3061,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 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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -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 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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -124,360 +124,6 @@
<h4 class="name" id="assign"><span class="type-signature"></span>assign<span class="signature">(obj)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line265">line 265</a>
</li></ul></dd>
</dl>
<div class="description">
<p>Object::assign polyfill</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>...objs</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">(arr, predicate)</span><span class="type-signature"> &rarr; {Array}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line243">line 243</a>
</li></ul></dd>
</dl>
<div class="description">
<p>Array::find polyfill</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>arr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>predicate</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getAndroidVersionName"><span class="type-signature"></span>getAndroidVersionName<span class="signature">(version)</span><span class="type-signature"> &rarr; {string}</span></h4>
@ -490,7 +136,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line120">line 120</a>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line80">line 80</a>
</li></ul></dd>
@ -545,7 +191,7 @@
6.x - Marshmallow
7.x - Nougat
8.x - Oreo
9.x - Pie</p>
9.x - ?</p>
</div>
@ -668,7 +314,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line293">line 293</a>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line202">line 202</a>
</li></ul></dd>
@ -815,7 +461,7 @@
<h4 class="name" id="getBrowserTypeByAlias"><span class="type-signature"></span>getBrowserTypeByAlias<span class="signature">(browserAlias)</span><span class="type-signature"> &rarr; {string}</span></h4>
<h4 class="name" id="getBrowserTypeByAlias"><span class="type-signature"></span>getBrowserTypeByAlias<span class="signature">(browserName)</span><span class="type-signature"> &rarr; {string}</span></h4>
@ -827,7 +473,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line306">line 306</a>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line215">line 215</a>
</li></ul></dd>
@ -910,7 +556,7 @@
<tr>
<td class="name"><code>browserAlias</code></td>
<td class="name"><code>browserName</code></td>
<td class="type">
@ -1163,185 +809,6 @@
<h4 class="name" id="getMacOSVersionName"><span class="type-signature"></span>getMacOSVersionName<span class="signature">(version)</span><span class="type-signature"> &rarr; {string}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line76">line 76</a>
</li></ul></dd>
</dl>
<div class="description">
<p>Get macOS version name
10.5 - Leopard
10.6 - Snow Leopard
10.7 - Lion
10.8 - Mountain Lion
10.9 - Mavericks
10.10 - Yosemite
10.11 - El Capitan
10.12 - Sierra
10.13 - High Sierra
10.14 - Mojave
10.15 - Catalina
11 - Big Sur
12 - Monterey
13 - Ventura
14 - Sonoma
15 - Sequoia</p>
</div>
<h5>Example</h5>
<pre class="prettyprint"><code>getMacOSVersionName("10.14") // 'Mojave'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<p>versionName</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="getSecondMatch"><span class="type-signature"></span>getSecondMatch<span class="signature">(regexp, ua)</span><span class="type-signature"> &rarr; {Array|Object|*|boolean|string}</span></h4>
@ -1538,7 +1005,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line150">line 150</a>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line109">line 109</a>
</li></ul></dd>
@ -1697,7 +1164,7 @@
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line224">line 224</a>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line181">line 181</a>
</li></ul></dd>
@ -2711,7 +2178,7 @@ like <code>&quot;iPhone&quot;</code> or <code>&quot;Kindle Fire HD 7&quot;</code
<br class="clear">
<footer>
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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -65,7 +65,7 @@
<li><strong>Multi-platform.</strong> It's browser- and node-ready, so you can use it in any environment.</li>
</ul>
<p>Don't hesitate to support the project on Github or <a href="https://opencollective.com/bowser">OpenCollective</a> if you like it ❤️ Also, contributors are always welcome!</p>
<p><a href="https://opencollective.com/bowser"><img src="https://opencollective.com/bowser/all/badge.svg?label=financial+contributors" alt="Financial Contributors on Open Collective"></a> <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> <img src="https://img.shields.io/npm/dm/bowser" alt="Downloads"></p>
<p><a href="https://travis-ci.org/lancedikson/bowser/"><img src="https://travis-ci.org/lancedikson/bowser.svg?branch=master" alt="Build Status"></a> <a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/lancedikson/bowser.svg" alt="Greenkeeper badge"></a> <a href="https://coveralls.io/github/lancedikson/bowser?branch=master"><img src="https://coveralls.io/repos/github/lancedikson/bowser/badge.svg?branch=master" alt="Coverage Status"></a></p>
<h1>Contents</h1>
<ul>
<li><a href="#overview">Overview</a></li>
@ -74,7 +74,7 @@
<li><a href="#contributing">How can I help?</a></li>
</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. Check it out on this page: https://bowser-js.github.io/bowser-online/.</p>
<p>The library is made to help to detect what browser your user has and gives you a convenient API to filter the users somehow depending on their browsers.</p>
<h3>⚠️ Version 2.0 breaking changes ⚠️</h3>
<p>Version 2.0 has drastically changed the API. All available methods are on the <a href="https://lancedikson.github.io/bowser/docs">docs page</a>.</p>
<p><em>For legacy code, check out the <a href="https://github.com/lancedikson/bowser/tree/v1.x">1.x</a> branch and install it through <code>npm install bowser@1.9.4</code>.</em></p>
@ -153,13 +153,13 @@ const isValidBrowser = browser.satisfies({
// or in general
chrome: &quot;~20.1.1432&quot;,
firefox: &quot;>31&quot;,
opera: &quot;>=22&quot;,
opera: &quot;>=22&quot;
// also supports equality operator
chrome: &quot;=20.1.1432&quot;, // will match particular build only
// and loose-equality operator
chrome: &quot;~20&quot;, // will match any 20.* sub-version
chrome: &quot;~20&quot; // will match any 20.* sub-version
chrome: &quot;~20.1&quot; // will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
});
</code></pre>
@ -174,26 +174,6 @@ list of aliases can be found in <a href="src/constants.js">the file</a>.</p>
<ul>
<li><a href="https://github.com/BigBadBleuCheese/Kong">Kong</a> - A C# port of Bowser.</li>
</ul>
<h2>Contributors</h2>
<h3>Code Contributors</h3>
<p>This project exists thanks to all the people who contribute. [<a href="CONTRIBUTING.md">Contribute</a>].
<a href="https://github.com/lancedikson/bowser/graphs/contributors"><img src="https://opencollective.com/bowser/contributors.svg?width=890&button=false" /></a></p>
<h3>Financial Contributors</h3>
<p>Become a financial contributor and help us sustain our community. [<a href="https://opencollective.com/bowser/contribute">Contribute</a>]</p>
<h4>Individuals</h4>
<p><a href="https://opencollective.com/bowser"><img src="https://opencollective.com/bowser/individuals.svg?width=890"></a></p>
<h4>Organizations</h4>
<p>Support this project with your organization. Your logo will show up here with a link to your website. [<a href="https://opencollective.com/bowser/contribute">Contribute</a>]</p>
<p><a href="https://opencollective.com/bowser/organization/0/website"><img src="https://opencollective.com/bowser/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/1/website"><img src="https://opencollective.com/bowser/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/2/website"><img src="https://opencollective.com/bowser/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/3/website"><img src="https://opencollective.com/bowser/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/4/website"><img src="https://opencollective.com/bowser/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/5/website"><img src="https://opencollective.com/bowser/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/6/website"><img src="https://opencollective.com/bowser/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/7/website"><img src="https://opencollective.com/bowser/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/8/website"><img src="https://opencollective.com/bowser/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/bowser/organization/9/website"><img src="https://opencollective.com/bowser/organization/9/avatar.svg"></a></p>
<h2>License</h2>
<p>Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.</p></article>
</section>
@ -210,7 +190,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 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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -126,7 +126,7 @@ class Parser {
parseBrowser() {
this.parsedResult.browser = {};
const browserDescriptor = Utils.find(browserParsersList, (_browser) => {
const browserDescriptor = browserParsersList.find((_browser) => {
if (typeof _browser.test === 'function') {
return _browser.test(this);
}
@ -209,7 +209,7 @@ class Parser {
parseOS() {
this.parsedResult.os = {};
const os = Utils.find(osParsersList, (_os) => {
const os = osParsersList.find((_os) => {
if (typeof _os.test === 'function') {
return _os.test(this);
}
@ -285,7 +285,7 @@ class Parser {
parsePlatform() {
this.parsedResult.platform = {};
const platform = Utils.find(platformParsersList, (_platform) => {
const platform = platformParsersList.find((_platform) => {
if (typeof _platform.test === 'function') {
return _platform.test(this);
}
@ -336,7 +336,7 @@ class Parser {
parseEngine() {
this.parsedResult.engine = {};
const engine = Utils.find(enginesParsersList, (_engine) => {
const engine = enginesParsersList.find((_engine) => {
if (typeof _engine.test === 'function') {
return _engine.test(this);
}
@ -357,7 +357,6 @@ class Parser {
/**
* Parse full information about the browser
* @returns {Parser}
*/
parse() {
this.parseBrowser();
@ -373,7 +372,7 @@ class Parser {
* @return {ParsedResult}
*/
getResult() {
return Utils.assign({}, this.parsedResult);
return Object.assign({}, this.parsedResult);
}
/**
@ -415,7 +414,7 @@ class Parser {
if (platformsAndOSCounter > 0) {
const platformsAndOSNames = Object.keys(platformsAndOSes);
const OSMatchingDefinition = Utils.find(platformsAndOSNames, name => (this.isOS(name)));
const OSMatchingDefinition = platformsAndOSNames.find(name => (this.isOS(name)));
if (OSMatchingDefinition) {
const osResult = this.satisfies(platformsAndOSes[OSMatchingDefinition]);
@ -425,10 +424,7 @@ class Parser {
}
}
const platformMatchingDefinition = Utils.find(
platformsAndOSNames,
name => (this.isPlatform(name)),
);
const platformMatchingDefinition = platformsAndOSNames.find(name => (this.isPlatform(name)));
if (platformMatchingDefinition) {
const platformResult = this.satisfies(platformsAndOSes[platformMatchingDefinition]);
@ -440,7 +436,7 @@ class Parser {
if (browsersCounter > 0) {
const browserNames = Object.keys(browsers);
const matchingDefinition = Utils.find(browserNames, name => (this.isBrowser(name, true)));
const matchingDefinition = browserNames.find(name => (this.isBrowser(name, true)));
if (matchingDefinition !== void 0) {
return this.compareVersion(browsers[matchingDefinition]);
@ -519,12 +515,10 @@ 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, includingAlias = false) {
return this.isBrowser(anything, includingAlias) || this.isOS(anything)
|| this.isPlatform(anything);
is(anything) {
return this.isBrowser(anything) || this.isOS(anything) || this.isPlatform(anything);
}
/**
@ -552,7 +546,7 @@ export default Parser;
<br class="clear">
<footer>
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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

View File

@ -27,7 +27,7 @@
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#assign">assign</a></li><li><a href="global.html#find">find</a></li><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getMacOSVersionName">getMacOSVersionName</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getEngineName">getEngineName</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#isBrowser">isBrowser</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#satisfies">satisfies</a></li><li data-type='method'><a href="Parser.html#some">some</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#getAndroidVersionName">getAndroidVersionName</a></li><li><a href="global.html#getBrowserAlias">getBrowserAlias</a></li><li><a href="global.html#getBrowserTypeByAlias">getBrowserTypeByAlias</a></li><li><a href="global.html#getFirstMatch">getFirstMatch</a></li><li><a href="global.html#getSecondMatch">getSecondMatch</a></li><li><a href="global.html#getVersionPrecision">getVersionPrecision</a></li><li><a href="global.html#map">map</a></li><li><a href="global.html#matchAndReturnConst">matchAndReturnConst</a></li></ul>
</nav>
<div id="main">
@ -97,64 +97,6 @@ export default class Utils {
}
}
/**
* Get macOS version name
* 10.5 - Leopard
* 10.6 - Snow Leopard
* 10.7 - Lion
* 10.8 - Mountain Lion
* 10.9 - Mavericks
* 10.10 - Yosemite
* 10.11 - El Capitan
* 10.12 - Sierra
* 10.13 - High Sierra
* 10.14 - Mojave
* 10.15 - Catalina
* 11 - Big Sur
* 12 - Monterey
* 13 - Ventura
* 14 - Sonoma
* 15 - Sequoia
*
* @example
* getMacOSVersionName("10.14") // 'Mojave'
*
* @param {string} version
* @return {string} versionName
*/
static getMacOSVersionName(version) {
const v = version.split('.').splice(0, 2).map(s => parseInt(s, 10) || 0);
v.push(0);
const major = v[0];
const minor = v[1];
if (major === 10) {
switch (minor) {
case 5: return 'Leopard';
case 6: return 'Snow Leopard';
case 7: return 'Lion';
case 8: return 'Mountain Lion';
case 9: return 'Mavericks';
case 10: return 'Yosemite';
case 11: return 'El Capitan';
case 12: return 'Sierra';
case 13: return 'High Sierra';
case 14: return 'Mojave';
case 15: return 'Catalina';
default: return undefined;
}
}
switch (major) {
case 11: return 'Big Sur';
case 12: return 'Monterey';
case 13: return 'Ventura';
case 14: return 'Sonoma';
case 15: return 'Sequoia';
default: return undefined;
}
}
/**
* Get Android version name
* 1.5 - Cupcake
@ -171,7 +113,7 @@ export default class Utils {
* 6.x - Marshmallow
* 7.x - Nougat
* 8.x - Oreo
* 9.x - Pie
* 9.x - ?
*
* @example
* getAndroidVersionName("7.0") // 'Nougat'
@ -196,7 +138,6 @@ export default class Utils {
if (v[0] === 6) return 'Marshmallow';
if (v[0] === 7) return 'Nougat';
if (v[0] === 8) return 'Oreo';
if (v[0] === 9) return 'Pie';
return undefined;
}
@ -272,8 +213,6 @@ export default class Utils {
return -1;
}
}
return undefined;
}
/**
@ -295,54 +234,6 @@ export default class Utils {
return result;
}
/**
* Array::find polyfill
*
* @param {Array} arr
* @param {Function} predicate
* @return {Array}
*/
static find(arr, predicate) {
let i;
let l;
if (Array.prototype.find) {
return Array.prototype.find.call(arr, predicate);
}
for (i = 0, l = arr.length; i &lt; l; i += 1) {
const value = arr[i];
if (predicate(value, i)) {
return value;
}
}
return undefined;
}
/**
* Object::assign polyfill
*
* @param {Object} obj
* @param {Object} ...objs
* @return {Object}
*/
static assign(obj, ...assigners) {
const result = obj;
let i;
let l;
if (Object.assign) {
return Object.assign(obj, ...assigners);
}
for (i = 0, l = assigners.length; i &lt; l; i += 1) {
const assigner = assigners[i];
if (typeof assigner === 'object' &amp;&amp; assigner !== null) {
const keys = Object.keys(assigner);
keys.forEach((key) => {
result[key] = assigner[key];
});
}
}
return obj;
}
/**
* Get short version/alias for a browser name
*
@ -362,11 +253,11 @@ export default class Utils {
* @example
* getBrowserAlias('edge') // Microsoft Edge
*
* @param {string} browserAlias
* @param {string} browserName
* @return {string}
*/
static getBrowserTypeByAlias(browserAlias) {
return BROWSER_MAP[browserAlias] || '';
static getBrowserTypeByAlias(browserAlia) {
return BROWSER_MAP[browserAlia] || '';
}
}
</code></pre>
@ -383,7 +274,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 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.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Jul 17 2019 13:52:37 GMT+0300 (Eastern European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

104
index.d.ts vendored
View File

@ -1,5 +1,5 @@
// Type definitions for Bowser v2
// Project: https://github.com/bowser-js/bowser
// Project: https://github.com/lancedikson/bowser
// Definitions by: Alexander P. Cerutti <https://github.com/alexandercerutti>,
export = Bowser;
@ -22,26 +22,10 @@ declare namespace Bowser {
function parse(UA: string): Parser.ParsedResult;
/**
* Constants exposed via bowser getters
*/
const BROWSER_MAP: Record<string, string>;
const ENGINE_MAP: Record<string, string>;
const OS_MAP: Record<string, string>;
const PLATFORMS_MAP: Record<string, string>;
namespace Parser {
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
@ -51,18 +35,17 @@ declare namespace Bowser {
/**
* Get browser's name
* @param {Boolean} [toLowerCase] return lower-cased value
* @return {String} Browser's name or an empty string
*/
getBrowserName(toLowerCase?: boolean): string;
getBrowserName(): string;
/**
* Get browser's version
* @return {String} version of browser
*/
getBrowserVersion(): string | undefined;
getBrowserVersion(): string;
/**
* Get OS
@ -113,13 +96,6 @@ 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}
@ -138,51 +114,16 @@ 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, 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;
is(anything: any): boolean;
/**
* Parse full information about the browser
* @returns {Parser.Parser}
*/
parse(): Parser.Parser;
parse(): void;
/**
* Get parsed browser object
@ -234,40 +175,7 @@ declare namespace Bowser {
satisfies(checkTree: checkTree): boolean | undefined;
/**
* Check if the browser name equals the passed string
* @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 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)`
* Check if any of the given values satifies `.is(anything)`
* @param {string[]} anythings
* @returns {boolean} true if at least one condition is satisfied, false otherwise.
*/

8144
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
{
"name": "bowser",
"version": "2.5.1",
"description": "Lightweight browser detector",
"keywords": [
"browser",
@ -11,52 +12,45 @@
"ender",
"sniff"
],
"homepage": "https://github.com/bowser-js/bowser",
"homepage": "https://github.com/lancedikson/bowser",
"author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)",
"contributors": [
{
"name": "Denis Demchenko",
"url": "http://twitter.com/lancedikson"
},
{
"name": "Naor Peled",
"url": "https://github.com/naorpeled"
}
],
"main": "es5.js",
"browser": "es5.js",
"module": "src/bowser.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/bowser-js/bowser.git"
"url": "git+https://github.com/lancedikson/bowser.git"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.8.0",
"@babel/polyfill": "^7.8.3",
"@babel/preset-env": "^7.8.2",
"@babel/register": "^7.8.3",
"ava": "^3.0.0",
"babel-eslint": "^10.0.3",
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.5.4",
"@babel/register": "^7.4.4",
"ava": "^2.2.0",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-istanbul": "^6.0.0",
"compression-webpack-plugin": "^4.0.0",
"coveralls": "^3.0.6",
"babel-plugin-istanbul": "^5.1.4",
"compression-webpack-plugin": "^3.0.0",
"coveralls": "^3.0.5",
"docdash": "^1.1.1",
"eslint": "^6.5.1",
"eslint": "^6.0.1",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-ava": "^10.0.0",
"eslint-plugin-import": "^2.18.2",
"gh-pages": "^3.0.0",
"eslint-plugin-ava": "^7.1.0",
"eslint-plugin-import": "^2.18.0",
"gh-pages": "^2.0.1",
"jsdoc": "^3.6.3",
"nyc": "^15.0.0",
"sinon": "^9.0.0",
"testem": "^3.0.0",
"webpack": "^4.41.0",
"webpack-bundle-analyzer": "^3.5.2",
"webpack-cli": "^3.3.9",
"nyc": "^14.1.1",
"sinon": "^7.3.2",
"testem": "^2.17.0",
"webpack": "^4.35.3",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.6",
"yamljs": "^0.3.0"
},
"ava": {
@ -65,7 +59,7 @@
]
},
"bugs": {
"url": "https://github.com/bowser-js/bowser/issues"
"url": "https://github.com/lancedikson/bowser/issues"
},
"directories": {
"test": "test"
@ -74,9 +68,9 @@
"build": "webpack --config webpack.config.js",
"generate-and-deploy-docs": "npm run generate-docs && gh-pages --dist docs --dest docs",
"watch": "webpack --watch --config webpack.config.js",
"deploy": "jsdoc -c jsdoc.json && gh-pages --dist docs --dest docs",
"prepublishOnly": "npm run build",
"lint:check": "eslint ./src",
"lint:fix": "eslint --fix ./src",
"lint": "eslint ./src",
"testem": "testem",
"test": "nyc --reporter=html --reporter=text ava",
"test:watch": "ava --watch",

View File

@ -1,6 +1,6 @@
/*!
* Bowser - a browser detector
* https://github.com/bowser-js/bowser
* https://github.com/lancedikson/bowser
* MIT License | (c) Dustin Diaz 2012-2015
* MIT License | (c) Denis Demchenko 2015-2019
*/

View File

@ -1,169 +1,108 @@
// NOTE: this list must be up-to-date with browsers listed in
// test/acceptance/useragentstrings.yml
export const BROWSER_ALIASES_MAP = {
AmazonBot: 'amazonbot',
'Amazon Silk': 'amazon_silk',
'Android Browser': 'android',
BaiduSpider: 'baiduspider',
Bada: 'bada',
BingCrawler: 'bingcrawler',
BlackBerry: 'blackberry',
'ChatGPT-User': 'chatgpt_user',
Chrome: 'chrome',
ClaudeBot: 'claudebot',
Chromium: 'chromium',
Diffbot: 'diffbot',
DuckDuckBot: 'duckduckbot',
Electron: 'electron',
Epiphany: 'epiphany',
FacebookExternalHit: 'facebookexternalhit',
Firefox: 'firefox',
Focus: 'focus',
Generic: 'generic',
'Google Search': 'google_search',
Googlebot: 'googlebot',
GPTBot: 'gptbot',
'Internet Explorer': 'ie',
InternetArchiveCrawler: 'internetarchivecrawler',
'K-Meleon': 'k_meleon',
LibreWolf: 'librewolf',
Maxthon: 'maxthon',
'Meta-ExternalAds': 'meta_externalads',
'Meta-ExternalAgent': 'meta_externalagent',
'Meta-ExternalFetcher': 'meta_externalfetcher',
'Meta-WebIndexer': 'meta_webindexer',
'Microsoft Edge': 'edge',
'MZ Browser': 'mz',
'NAVER Whale Browser': 'naver',
'OAI-SearchBot': 'oai_searchbot',
Omgilibot: 'omgilibot',
Opera: 'opera',
'Opera Coast': 'opera_coast',
'Pale Moon': 'pale_moon',
PerplexityBot: 'perplexitybot',
'Perplexity-User': 'perplexity_user',
PhantomJS: 'phantomjs',
PingdomBot: 'pingdombot',
Puffin: 'puffin',
QQ: 'qq',
QQLite: 'qqlite',
QupZilla: 'qupzilla',
Roku: 'roku',
Safari: 'safari',
Sailfish: 'sailfish',
'Samsung Internet for Android': 'samsung_internet',
SeaMonkey: 'seamonkey',
Sleipnir: 'sleipnir',
'Sogou Browser': 'sogou',
Swing: 'swing',
Tizen: 'tizen',
'UC Browser': 'uc',
Vivaldi: 'vivaldi',
'WebOS Browser': 'webos',
WeChat: 'wechat',
YahooSlurp: 'yahooslurp',
'Yandex Browser': 'yandex',
YandexBot: 'yandexbot',
YouBot: 'youbot',
Roku: 'roku',
};
export const BROWSER_MAP = {
amazonbot: 'AmazonBot',
amazon_silk: 'Amazon Silk',
android: 'Android Browser',
baiduspider: 'BaiduSpider',
bada: 'Bada',
bingcrawler: 'BingCrawler',
blackberry: 'BlackBerry',
chatgpt_user: 'ChatGPT-User',
chrome: 'Chrome',
claudebot: 'ClaudeBot',
chromium: 'Chromium',
diffbot: 'Diffbot',
duckduckbot: 'DuckDuckBot',
edge: 'Microsoft Edge',
electron: 'Electron',
epiphany: 'Epiphany',
facebookexternalhit: 'FacebookExternalHit',
firefox: 'Firefox',
focus: 'Focus',
generic: 'Generic',
google_search: 'Google Search',
googlebot: 'Googlebot',
gptbot: 'GPTBot',
ie: 'Internet Explorer',
internetarchivecrawler: 'InternetArchiveCrawler',
k_meleon: 'K-Meleon',
librewolf: 'LibreWolf',
maxthon: 'Maxthon',
meta_externalads: 'Meta-ExternalAds',
meta_externalagent: 'Meta-ExternalAgent',
meta_externalfetcher: 'Meta-ExternalFetcher',
meta_webindexer: 'Meta-WebIndexer',
edge: 'Microsoft Edge',
mz: 'MZ Browser',
naver: 'NAVER Whale Browser',
oai_searchbot: 'OAI-SearchBot',
omgilibot: 'Omgilibot',
opera: 'Opera',
opera_coast: 'Opera Coast',
pale_moon: 'Pale Moon',
perplexitybot: 'PerplexityBot',
perplexity_user: 'Perplexity-User',
phantomjs: 'PhantomJS',
pingdombot: 'PingdomBot',
puffin: 'Puffin',
qq: 'QQ Browser',
qqlite: 'QQ Browser Lite',
qupzilla: 'QupZilla',
roku: 'Roku',
safari: 'Safari',
sailfish: 'Sailfish',
samsung_internet: 'Samsung Internet for Android',
seamonkey: 'SeaMonkey',
sleipnir: 'Sleipnir',
sogou: 'Sogou Browser',
swing: 'Swing',
tizen: 'Tizen',
uc: 'UC Browser',
vivaldi: 'Vivaldi',
webos: 'WebOS Browser',
wechat: 'WeChat',
yahooslurp: 'YahooSlurp',
yandex: 'Yandex Browser',
yandexbot: 'YandexBot',
youbot: 'YouBot',
};
export const PLATFORMS_MAP = {
bot: 'bot',
desktop: 'desktop',
mobile: 'mobile',
tablet: 'tablet',
mobile: 'mobile',
desktop: 'desktop',
tv: 'tv',
};
export const OS_MAP = {
Android: 'Android',
Bada: 'Bada',
BlackBerry: 'BlackBerry',
ChromeOS: 'Chrome OS',
HarmonyOS: 'HarmonyOS',
iOS: 'iOS',
Linux: 'Linux',
WindowsPhone: 'Windows Phone',
Windows: 'Windows',
MacOS: 'macOS',
iOS: 'iOS',
Android: 'Android',
WebOS: 'WebOS',
BlackBerry: 'BlackBerry',
Bada: 'Bada',
Tizen: 'Tizen',
Linux: 'Linux',
ChromeOS: 'Chrome OS',
PlayStation4: 'PlayStation 4',
Roku: 'Roku',
Tizen: 'Tizen',
WebOS: 'WebOS',
Windows: 'Windows',
WindowsPhone: 'Windows Phone',
};
export const ENGINE_MAP = {
Blink: 'Blink',
EdgeHTML: 'EdgeHTML',
Gecko: 'Gecko',
Presto: 'Presto',
Blink: 'Blink',
Trident: 'Trident',
Presto: 'Presto',
Gecko: 'Gecko',
WebKit: 'WebKit',
};

View File

@ -28,227 +28,6 @@ import Utils from './utils.js';
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
const browsersList = [
/* GPTBot */
{
test: [/gptbot/i],
describe(ua) {
const browser = {
name: 'GPTBot',
};
const version = Utils.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* ChatGPT-User */
{
test: [/chatgpt-user/i],
describe(ua) {
const browser = {
name: 'ChatGPT-User',
};
const version = Utils.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* OAI-SearchBot */
{
test: [/oai-searchbot/i],
describe(ua) {
const browser = {
name: 'OAI-SearchBot',
};
const version = Utils.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* ClaudeBot */
{
test: [/claudebot/i, /claude-web/i, /claude-user/i, /claude-searchbot/i],
describe(ua) {
const browser = {
name: 'ClaudeBot',
};
const version = Utils.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Omgilibot */
{
test: [/omgilibot/i, /webzio-extended/i],
describe(ua) {
const browser = {
name: 'Omgilibot',
};
const version = Utils.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Diffbot */
{
test: [/diffbot/i],
describe(ua) {
const browser = {
name: 'Diffbot',
};
const version = Utils.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* PerplexityBot */
{
test: [/perplexitybot/i],
describe(ua) {
const browser = {
name: 'PerplexityBot',
};
const version = Utils.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Perplexity-User */
{
test: [/perplexity-user/i],
describe(ua) {
const browser = {
name: 'Perplexity-User',
};
const version = Utils.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* YouBot */
{
test: [/youbot/i],
describe(ua) {
const browser = {
name: 'YouBot',
};
const version = Utils.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Meta-WebIndexer */
{
test: [/meta-webindexer/i],
describe(ua) {
const browser = {
name: 'Meta-WebIndexer',
};
const version = Utils.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Meta-ExternalAds */
{
test: [/meta-externalads/i],
describe(ua) {
const browser = {
name: 'Meta-ExternalAds',
};
const version = Utils.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Meta-ExternalAgent */
{
test: [/meta-externalagent/i],
describe(ua) {
const browser = {
name: 'Meta-ExternalAgent',
};
const version = Utils.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Meta-ExternalFetcher */
{
test: [/meta-externalfetcher/i],
describe(ua) {
const browser = {
name: 'Meta-ExternalFetcher',
};
const version = Utils.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Googlebot */
{
test: [/googlebot/i],
@ -266,131 +45,6 @@ const browsersList = [
},
},
/* AmazonBot */
{
test: [/amazonbot/i],
describe(ua) {
const browser = {
name: 'AmazonBot',
};
const version = Utils.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* BingCrawler */
{
test: [/bingbot/i],
describe(ua) {
const browser = {
name: 'BingCrawler',
};
const version = Utils.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* BaiduSpider */
{
test: [/baiduspider/i],
describe(ua) {
const browser = {
name: 'BaiduSpider',
};
const version = Utils.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* DuckDuckBot */
{
test: [/duckduckbot/i],
describe(ua) {
const browser = {
name: 'DuckDuckBot',
};
const version = Utils.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* InternetArchiveCrawler */
{
test: [/ia_archiver/i],
describe(ua) {
const browser = {
name: 'InternetArchiveCrawler',
};
const version = Utils.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* FacebookExternalHit */
{
test: [/facebookexternalhit/i, /facebookcatalog/i],
describe() {
return {
name: 'FacebookExternalHit',
};
},
},
/* YahooSlurp */
{
test: [/yahoo!?[\s/]*slurp/i],
describe() {
return {
name: 'YahooSlurp',
};
},
},
/* YandexBot */
{
test: [/yandexbot/i, /yandexmobilebot/i],
describe() {
return {
name: 'YandexBot',
};
},
},
/* PingdomBot */
{
test: [/pingdom/i],
describe() {
return {
name: 'PingdomBot',
};
},
},
/* Opera < 13.0 */
{
test: [/opera/i],
@ -454,21 +108,6 @@ 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) {
@ -529,21 +168,6 @@ const browsersList = [
return browser;
},
},
{
test: [/opt\/\d+(?:.?_?\d+)+/i],
describe(ua) {
const browser = {
name: 'Opera Touch',
};
const version = Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
{
test: [/yabrowser/i],
describe(ua) {
@ -664,21 +288,6 @@ const browsersList = [
return browser;
},
},
{
test: [/qqbrowser/i],
describe(ua) {
const browser = {
name: (/qqbrowserlite/i).test(ua) ? 'QQ Browser Lite' : 'QQ Browser',
};
const version = Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
{
test: [/msie|trident/i],
describe(ua) {
@ -892,21 +501,6 @@ const browsersList = [
return browser;
},
},
{
test: [/librewolf/i],
describe(ua) {
const browser = {
name: 'LibreWolf',
};
const version = Utils.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
{
test: [/firefox|iceweasel|fxios/i],
describe(ua) {
@ -922,54 +516,6 @@ const browsersList = [
return browser;
},
},
{
test: [/electron/i],
describe(ua) {
const browser = {
name: 'Electron',
};
const version = Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
{
test: [/sogoumobilebrowser/i, /metasr/i, /se 2\.[x]/i],
describe(ua) {
const browser = {
name: 'Sogou Browser',
};
const sogouMobileVersion = Utils.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
const chromiumVersion = Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
const seVersion = Utils.getFirstMatch(/se ([\d.]+)x/i, ua);
const version = sogouMobileVersion || chromiumVersion || seVersion;
if (version) {
browser.version = version;
}
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) {
@ -1000,21 +546,6 @@ const browsersList = [
return browser;
},
},
{
test: [/GSA/i],
describe(ua) {
const browser = {
name: 'Google Search',
};
const version = Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Android Browser */
{

View File

@ -28,7 +28,7 @@ export default [
/* Windows */
{
test: [/windows /i],
test: [/windows/i],
describe(ua) {
const version = Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, ua);
const versionName = Utils.getWindowsVersionName(version);
@ -41,36 +41,15 @@ export default [
},
},
/* Firefox on iPad */
{
test: [/Macintosh(.*?) FxiOS(.*?)\//],
describe(ua) {
const result = {
name: OS_MAP.iOS,
};
const version = Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/, ua);
if (version) {
result.version = version;
}
return result;
},
},
/* macOS */
{
test: [/macintosh/i],
describe(ua) {
const version = Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, '.');
const versionName = Utils.getMacOSVersionName(version);
const os = {
return {
name: OS_MAP.MacOS,
version,
};
if (versionName) {
os.versionName = versionName;
}
return os;
},
},
@ -87,18 +66,6 @@ export default [
},
},
/* HarmonyOS */
{
test: [/OpenHarmony/i],
describe(ua) {
const version = Utils.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i, ua);
return {
name: OS_MAP.HarmonyOS,
version,
};
},
},
/* Android */
{
test(parser) {

View File

@ -12,254 +12,12 @@ export default [
test: [/googlebot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
type: 'bot',
vendor: 'Google',
};
},
},
/* AmazonBot */
{
test: [/amazonbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Amazon',
};
},
},
/* GPTBot */
{
test: [/gptbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'OpenAI',
};
},
},
/* ChatGPT-User */
{
test: [/chatgpt-user/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'OpenAI',
};
},
},
/* OAI-SearchBot */
{
test: [/oai-searchbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'OpenAI',
};
},
},
/* Baidu */
{
test: [/baiduspider/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Baidu',
};
},
},
/* Bingbot */
{
test: [/bingbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Bing',
};
},
},
/* DuckDuckBot */
{
test: [/duckduckbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'DuckDuckGo',
};
},
},
/* ClaudeBot */
{
test: [/claudebot/i, /claude-web/i, /claude-user/i, /claude-searchbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Anthropic',
};
},
},
/* Omgilibot */
{
test: [/omgilibot/i, /webzio-extended/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Webz.io',
};
},
},
/* Diffbot */
{
test: [/diffbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Diffbot',
};
},
},
/* PerplexityBot */
{
test: [/perplexitybot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Perplexity AI',
};
},
},
/* Perplexity-User */
{
test: [/perplexity-user/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Perplexity AI',
};
},
},
/* YouBot */
{
test: [/youbot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'You.com',
};
},
},
/* Internet Archive Crawler */
{
test: [/ia_archiver/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Internet Archive',
};
},
},
/* Meta-WebIndexer */
{
test: [/meta-webindexer/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Meta',
};
},
},
/* Meta-ExternalAds */
{
test: [/meta-externalads/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Meta',
};
},
},
/* Meta-ExternalAgent */
{
test: [/meta-externalagent/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Meta',
};
},
},
/* Meta-ExternalFetcher */
{
test: [/meta-externalfetcher/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Meta',
};
},
},
/* Meta Web Crawler */
{
test: [/facebookexternalhit/i, /facebookcatalog/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Meta',
};
},
},
/* Yahoo! Slurp */
{
test: [/yahoo/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Yahoo',
};
},
},
/* Yandex */
{
test: [/yandexbot/i, /yandexmobilebot/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Yandex',
};
},
},
/* Pingdom */
{
test: [/pingdom/i],
describe() {
return {
type: PLATFORMS_MAP.bot,
vendor: 'Pingdom',
};
},
},
/* Huawei */
{
test: [/huawei/i],
@ -299,18 +57,6 @@ export default [
},
},
/* Firefox on iPad */
{
test: [/Macintosh(.*?) FxiOS(.*?)\//],
describe() {
return {
type: PLATFORMS_MAP.tablet,
vendor: 'Apple',
model: 'iPad',
};
},
},
/* Amazon Kindle Fire */
{
test: [/kftt build/i],
@ -336,7 +82,7 @@ export default [
/* Tablet */
{
test: [/tablet(?! pc)/i],
test: [/tablet/i],
describe() {
return {
type: PLATFORMS_MAP.tablet,
@ -372,22 +118,6 @@ 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],

View File

@ -82,12 +82,12 @@ class Parser {
parseBrowser() {
this.parsedResult.browser = {};
const browserDescriptor = Utils.find(browserParsersList, (_browser) => {
const browserDescriptor = browserParsersList.find((_browser) => {
if (typeof _browser.test === 'function') {
return _browser.test(this);
}
if (Array.isArray(_browser.test)) {
if (_browser.test instanceof Array) {
return _browser.test.some(condition => this.test(condition));
}
@ -165,12 +165,12 @@ class Parser {
parseOS() {
this.parsedResult.os = {};
const os = Utils.find(osParsersList, (_os) => {
const os = osParsersList.find((_os) => {
if (typeof _os.test === 'function') {
return _os.test(this);
}
if (Array.isArray(_os.test)) {
if (_os.test instanceof Array) {
return _os.test.some(condition => this.test(condition));
}
@ -241,12 +241,12 @@ class Parser {
parsePlatform() {
this.parsedResult.platform = {};
const platform = Utils.find(platformParsersList, (_platform) => {
const platform = platformParsersList.find((_platform) => {
if (typeof _platform.test === 'function') {
return _platform.test(this);
}
if (Array.isArray(_platform.test)) {
if (_platform.test instanceof Array) {
return _platform.test.some(condition => this.test(condition));
}
@ -292,12 +292,12 @@ class Parser {
parseEngine() {
this.parsedResult.engine = {};
const engine = Utils.find(enginesParsersList, (_engine) => {
const engine = enginesParsersList.find((_engine) => {
if (typeof _engine.test === 'function') {
return _engine.test(this);
}
if (Array.isArray(_engine.test)) {
if (_engine.test instanceof Array) {
return _engine.test.some(condition => this.test(condition));
}
@ -313,7 +313,6 @@ class Parser {
/**
* Parse full information about the browser
* @returns {Parser}
*/
parse() {
this.parseBrowser();
@ -329,7 +328,7 @@ class Parser {
* @return {ParsedResult}
*/
getResult() {
return Utils.assign({}, this.parsedResult);
return Object.assign({}, this.parsedResult);
}
/**
@ -371,7 +370,7 @@ class Parser {
if (platformsAndOSCounter > 0) {
const platformsAndOSNames = Object.keys(platformsAndOSes);
const OSMatchingDefinition = Utils.find(platformsAndOSNames, name => (this.isOS(name)));
const OSMatchingDefinition = platformsAndOSNames.find(name => (this.isOS(name)));
if (OSMatchingDefinition) {
const osResult = this.satisfies(platformsAndOSes[OSMatchingDefinition]);
@ -381,10 +380,7 @@ class Parser {
}
}
const platformMatchingDefinition = Utils.find(
platformsAndOSNames,
name => (this.isPlatform(name)),
);
const platformMatchingDefinition = platformsAndOSNames.find(name => (this.isPlatform(name)));
if (platformMatchingDefinition) {
const platformResult = this.satisfies(platformsAndOSes[platformMatchingDefinition]);
@ -396,7 +392,7 @@ class Parser {
if (browsersCounter > 0) {
const browserNames = Object.keys(browsers);
const matchingDefinition = Utils.find(browserNames, name => (this.isBrowser(name, true)));
const matchingDefinition = browserNames.find(name => (this.isBrowser(name, true)));
if (matchingDefinition !== void 0) {
return this.compareVersion(browsers[matchingDefinition]);
@ -408,7 +404,7 @@ class Parser {
/**
* Check if the browser name equals the passed string
* @param {string} browserName The string to compare with the browser name
* @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}
*/
@ -459,29 +455,14 @@ 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();
}
@ -490,12 +471,10 @@ 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, includingAlias = false) {
return this.isBrowser(anything, includingAlias) || this.isOS(anything)
|| this.isPlatform(anything);
is(anything) {
return this.isBrowser(anything) || this.isOS(anything) || this.isPlatform(anything);
}
/**

View File

@ -53,64 +53,6 @@ export default class Utils {
}
}
/**
* Get macOS version name
* 10.5 - Leopard
* 10.6 - Snow Leopard
* 10.7 - Lion
* 10.8 - Mountain Lion
* 10.9 - Mavericks
* 10.10 - Yosemite
* 10.11 - El Capitan
* 10.12 - Sierra
* 10.13 - High Sierra
* 10.14 - Mojave
* 10.15 - Catalina
* 11 - Big Sur
* 12 - Monterey
* 13 - Ventura
* 14 - Sonoma
* 15 - Sequoia
*
* @example
* getMacOSVersionName("10.14") // 'Mojave'
*
* @param {string} version
* @return {string} versionName
*/
static getMacOSVersionName(version) {
const v = version.split('.').splice(0, 2).map(s => parseInt(s, 10) || 0);
v.push(0);
const major = v[0];
const minor = v[1];
if (major === 10) {
switch (minor) {
case 5: return 'Leopard';
case 6: return 'Snow Leopard';
case 7: return 'Lion';
case 8: return 'Mountain Lion';
case 9: return 'Mavericks';
case 10: return 'Yosemite';
case 11: return 'El Capitan';
case 12: return 'Sierra';
case 13: return 'High Sierra';
case 14: return 'Mojave';
case 15: return 'Catalina';
default: return undefined;
}
}
switch (major) {
case 11: return 'Big Sur';
case 12: return 'Monterey';
case 13: return 'Ventura';
case 14: return 'Sonoma';
case 15: return 'Sequoia';
default: return undefined;
}
}
/**
* Get Android version name
* 1.5 - Cupcake
@ -127,7 +69,7 @@ export default class Utils {
* 6.x - Marshmallow
* 7.x - Nougat
* 8.x - Oreo
* 9.x - Pie
* 9.x - ?
*
* @example
* getAndroidVersionName("7.0") // 'Nougat'
@ -152,7 +94,6 @@ export default class Utils {
if (v[0] === 6) return 'Marshmallow';
if (v[0] === 7) return 'Nougat';
if (v[0] === 8) return 'Oreo';
if (v[0] === 9) return 'Pie';
return undefined;
}
@ -228,8 +169,6 @@ export default class Utils {
return -1;
}
}
return undefined;
}
/**
@ -251,54 +190,6 @@ export default class Utils {
return result;
}
/**
* Array::find polyfill
*
* @param {Array} arr
* @param {Function} predicate
* @return {Array}
*/
static find(arr, predicate) {
let i;
let l;
if (Array.prototype.find) {
return Array.prototype.find.call(arr, predicate);
}
for (i = 0, l = arr.length; i < l; i += 1) {
const value = arr[i];
if (predicate(value, i)) {
return value;
}
}
return undefined;
}
/**
* Object::assign polyfill
*
* @param {Object} obj
* @param {Object} ...objs
* @return {Object}
*/
static assign(obj, ...assigners) {
const result = obj;
let i;
let l;
if (Object.assign) {
return Object.assign(obj, ...assigners);
}
for (i = 0, l = assigners.length; i < l; i += 1) {
const assigner = assigners[i];
if (typeof assigner === 'object' && assigner !== null) {
const keys = Object.keys(assigner);
keys.forEach((key) => {
result[key] = assigner[key];
});
}
}
return obj;
}
/**
* Get short version/alias for a browser name
*
@ -313,15 +204,15 @@ export default class Utils {
}
/**
* Get browser name for a short version/alias
* Get short version/alias for a browser name
*
* @example
* getBrowserTypeByAlias('edge') // Microsoft Edge
* getBrowserAlias('edge') // Microsoft Edge
*
* @param {string} browserAlias
* @param {string} browserName
* @return {string}
*/
static getBrowserTypeByAlias(browserAlias) {
return BROWSER_MAP[browserAlias] || '';
static getBrowserTypeByAlias(browserAlia) {
return BROWSER_MAP[browserAlia] || '';
}
}

File diff suppressed because it is too large Load Diff

View File

@ -165,30 +165,6 @@ 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);
@ -223,8 +199,3 @@ 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);
});

View File

@ -1,18 +1,9 @@
import test from 'ava';
import {
getFirstMatch,
getSecondMatch,
matchAndReturnConst,
getWindowsVersionName,
getMacOSVersionName,
getAndroidVersionName,
getVersionPrecision,
compareVersions,
map,
find,
assign,
getBrowserAlias,
getBrowserTypeByAlias
getFirstMatch,
getWindowsVersionName,
compareVersions,
} from '../../src/utils';
test('getFirstMatch', (t) => {
@ -20,45 +11,11 @@ test('getFirstMatch', (t) => {
t.is(matchedVersion, '11.11.11');
});
test('getSecondMatch', (t) => {
const matchedVersion = getSecondMatch(/version\/(\S+).*version\/(\S+)/i, 'Chrome Version/11.11.11 Chrome Version/22.22.22');
t.is(matchedVersion, '22.22.22');
});
test('matchAndReturnConst', (t) => {
const _const = matchAndReturnConst(/version/i, 'version', "_const");
t.is(_const, '_const');
});
test('getWindowsVersionName', (t) => {
t.is(getWindowsVersionName('NT 5.0'), '2000');
t.is(getWindowsVersionName('XXX'), void 0);
});
test('getMacOSVersionName', (t) => {
t.is(getMacOSVersionName('10.14.5'), 'Mojave');
t.is(getMacOSVersionName('10.15'), 'Catalina');
t.is(getMacOSVersionName('11.0'), 'Big Sur');
t.is(getMacOSVersionName('12.3.1'), 'Monterey');
t.is(getMacOSVersionName('13.2.1'), 'Ventura');
t.is(getMacOSVersionName('14.0'), 'Sonoma');
t.is(getMacOSVersionName('15.1'), 'Sequoia');
t.is(getMacOSVersionName('10.999999'), void 0);
t.is(getMacOSVersionName('XXX'), void 0);
});
test('getAndroidVersionName', (t) => {
t.is(getAndroidVersionName('1.0'), void 0);
t.is(getAndroidVersionName('8.0'), 'Oreo');
t.is(getAndroidVersionName('9'), 'Pie');
t.is(getAndroidVersionName('XXX'), void 0);
});
test('getVersionPrecision', (t) => {
const precision = getVersionPrecision("10.14.5");
t.is(precision, 3);
});
test('compareVersions', (t) => {
const comparisionsTasks = [
['9.0', '10', -1],
@ -95,51 +52,7 @@ test('compareVersions', (t) => {
});
});
test('map', (t) => {
const result = map([1,2], (value) => value+2);
t.is(result[0], 3);
t.is(result[1], 4);
const original = Array.prototype.map;
delete Array.prototype.map;
const polyfillResult = map([1,2], (value) => value+2);
Array.prototype.map = original;
t.is(polyfillResult[0], 3);
t.is(polyfillResult[1], 4);
});
test('find', (t) => {
const result = find([1,2], (value) => value==2);
t.is(result, 2);
const original = Array.prototype.find;
delete Array.prototype.find;
const polyfillResultFound = find([1,2], (value) => value==2);
const polyfillResultNotFound = find([1,2], (value) => value==3);
Array.prototype.find = original;
t.is(polyfillResultFound, 2);
t.is(polyfillResultNotFound, undefined);
});
test('assign', (t) => {
const result = assign({}, { a: 1 }, { b: 1 }, { b: 2, c: 3 });
t.is(result['a'], 1);
t.is(result['b'], 2);
t.is(result['c'], 3);
const original = Object.assign;
delete Object.assign;
const polyfillResult = assign({}, { a: 1 }, { b: 1 }, null, { b: 2, c: 3 });
Object.assign = original;
t.is(polyfillResult['a'], 1);
t.is(polyfillResult['b'], 2);
t.is(polyfillResult['c'], 3);
});
test('getBrowserAlias', (t) => {
t.is(getBrowserAlias('Microsoft Edge'), 'edge');
t.is(getBrowserAlias('Unexisting Browser'), void 0);
});
test('getBrowserTypeByAlias', (t) => {
t.is(getBrowserTypeByAlias('edge'), 'Microsoft Edge');
t.is(getBrowserTypeByAlias(void 0), '');
});