1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Add eslint support

This commit is contained in:
Denis Demchenko 2017-12-20 23:29:06 +02:00
parent b1170af9d8
commit ad2589f699
11 changed files with 1110 additions and 183 deletions

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
src/bowser.js

6
.eslintrc.yml Normal file
View File

@ -0,0 +1,6 @@
extends: airbnb-base
rules:
no-underscore-dangle: 0
no-void: 0
plugins:
- ava

924
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,11 @@
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"eslint": "^4.13.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-ava": "^4.4.0",
"eslint-plugin-import": "^2.8.0",
"husky": "^0.14.3",
"sinon": "^2.4.1",
"testem": "^1.18.4",
"yamljs": "^0.3.0"
@ -42,6 +47,7 @@
"test": "test"
},
"scripts": {
"lint": "./node_modules/.bin/eslint ./src --fix",
"testem": "testem",
"test": "./node_modules/.bin/ava"
},

View File

@ -50,7 +50,7 @@ class Bowser {
* @param {Object} range
* @returns {Boolean}
*/
static notInRange(range) {}
// static notInRange(range) {}
// static filter(UACollection, range) {}

View File

@ -25,7 +25,7 @@
import {
getFirstMatch,
getSecondMatch
getSecondMatch,
} from './utils';
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
@ -36,16 +36,16 @@ const browsersList = [
test: [/opera/i],
describe(ua) {
const browser = {
name: 'Opera'
name: 'Opera',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:opera)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
/* Opera > 13.0 */
@ -53,157 +53,157 @@ const browsersList = [
test: [/opr|opios/i],
describe(ua) {
const browser = {
name: 'Opera'
name: 'Opera',
};
const version = getFirstMatch(/(?:opr|opios)[\s\/](\S+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
const version = getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/SamsungBrowser/i],
describe(ua) {
const browser = {
name: 'Samsung Internet for Android'
name: 'Samsung Internet for Android',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/coast/i],
describe(ua) {
const browser = {
name: 'Opera Coast'
name: 'Opera Coast',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:coast)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/yabrowser/i],
describe(ua) {
const browser = {
name: 'Yandex Browser'
name: 'Yandex Browser',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/ucbrowser/i],
describe(ua) {
const browser = {
name: 'UC Browser'
name: 'UC Browser',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:ucbrowser)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/mxios/i],
describe(ua) {
const browser = {
name: 'Maxthon'
name: 'Maxthon',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:mxios)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:mxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/epiphany/i],
describe(ua) {
const browser = {
name: 'Epiphany'
name: 'Epiphany',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:epiphany)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/puffin/i],
describe(ua) {
const browser = {
name: 'Puffin'
name: 'Puffin',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:puffin)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/sleipnir/i],
describe(ua) {
const browser = {
name: 'Sleipnir'
name: 'Sleipnir',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:sleipnir)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/k-meleon/i],
describe(ua) {
const browser = {
name: 'K-Meleon'
name: 'K-Meleon',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:k-meleon)[\s\/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/msie|trident/i],
describe(ua) {
const browser = {
name: 'Internet Explorer'
name: 'Internet Explorer',
};
const version = getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua);
@ -212,13 +212,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/edg([ea]|ios)/i],
describe(ua) {
const browser = {
name: 'Microsoft Edge'
name: 'Microsoft Edge',
};
const version = getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua);
@ -228,13 +228,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/vivaldi/i],
describe(ua) {
const browser = {
name: 'Vivaldi'
name: 'Vivaldi',
};
const version = getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua);
@ -243,13 +243,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/seamonkey/i],
describe(ua) {
const browser = {
name: 'SeaMonkey'
name: 'SeaMonkey',
};
const version = getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua);
@ -258,13 +258,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/sailfish/i],
describe(ua) {
const browser = {
name: 'Sailfish'
name: 'Sailfish',
};
const version = getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua);
@ -274,13 +274,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/silk/i],
describe(ua) {
const browser = {
name: 'Amazon Silk'
name: 'Amazon Silk',
};
const version = getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua);
@ -289,13 +289,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/phantom/i],
describe(ua) {
const browser = {
name: 'PhantomJS'
name: 'PhantomJS',
};
const version = getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, ua);
@ -304,13 +304,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/slimerjs/i],
describe(ua) {
const browser = {
name: 'SlimerJS'
name: 'SlimerJS',
};
const version = getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, ua);
@ -319,13 +319,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
describe(ua) {
const browser = {
name: 'BlackBerry'
name: 'BlackBerry',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, ua);
@ -334,13 +334,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/(web|hpw)os/i],
describe(ua) {
const browser = {
name: 'WebOS Browser'
name: 'WebOS Browser',
};
const version = getFirstMatch(commonVersionIdentifier, ua) || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.?_?\d+)+)/i, ua);
@ -349,13 +349,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/bada/i],
describe(ua) {
const browser = {
name: 'Bada'
name: 'Bada',
};
const version = getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, ua);
@ -364,13 +364,13 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/tizen/i],
describe(ua) {
const browser = {
name: 'Tizen'
name: 'Tizen',
};
const version = getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
@ -379,58 +379,58 @@ const browsersList = [
}
return browser;
}
},
},
{
test: [/qupzilla/i],
describe(ua) {
const browser = {
name: 'QupZilla'
name: 'QupZilla',
};
const version = getFirstMatch(/(?:qupzilla)[\s\/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
const version = getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/firefox|iceweasel|fxios/i],
describe(ua) {
const browser = {
name: 'Firefox'
name: 'Firefox',
};
const version = getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.?_?\d+)+)/i, ua);
const version = getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/chromium/i],
describe(ua) {
const browser = {
name: 'Chromium'
name: 'Chromium',
};
const version = getFirstMatch(/(?:chromium)[\s\/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
const version = getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
}
},
},
{
test: [/chrome|crios|crmo/i],
describe(ua) {
const browser = {
name: 'Chrome'
name: 'Chrome',
};
const version = getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
@ -439,7 +439,7 @@ const browsersList = [
}
return browser;
}
},
},
/* Android Browser */
@ -451,7 +451,7 @@ const browsersList = [
},
describe(ua) {
const browser = {
name: 'Android Browser'
name: 'Android Browser',
};
const version = getFirstMatch(commonVersionIdentifier, ua);
@ -460,7 +460,7 @@ const browsersList = [
}
return browser;
}
},
},
/* Safari */
@ -468,7 +468,7 @@ const browsersList = [
test: [/safari|applewebkit/i],
describe(ua) {
const browser = {
name: 'Safari'
name: 'Safari',
};
const version = getFirstMatch(commonVersionIdentifier, ua);
@ -477,7 +477,7 @@ const browsersList = [
}
return browser;
}
},
},
/* Googlebot */
@ -485,7 +485,7 @@ const browsersList = [
test: [/googlebot/i],
describe(ua) {
const browser = {
name: 'Googlebot'
name: 'Googlebot',
};
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
@ -494,7 +494,7 @@ const browsersList = [
}
return browser;
}
},
},
/* Something else */
@ -503,10 +503,10 @@ const browsersList = [
describe(ua) {
return {
name: getFirstMatch(/^(.*)\/(.*) /, ua),
version: getSecondMatch(/^(.*)\/(.*) /, ua)
version: getSecondMatch(/^(.*)\/(.*) /, ua),
};
}
}
},
},
];
export default browsersList;

View File

@ -1,5 +1,5 @@
import {
getFirstMatch
getFirstMatch,
} from './utils';
/*
@ -15,9 +15,9 @@ export default [
const version = getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, ua);
return {
name: 'EdgeHTML',
version
version,
};
}
},
},
/* Trident */
@ -25,7 +25,7 @@ export default [
test: [/trident/i],
describe(ua) {
const engine = {
name: 'Trident'
name: 'Trident',
};
const version = getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, ua);
@ -35,7 +35,7 @@ export default [
}
return engine;
}
},
},
/* Presto */
@ -45,7 +45,7 @@ export default [
},
describe(ua) {
const engine = {
name: 'Presto'
name: 'Presto',
};
const version = getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, ua);
@ -55,7 +55,7 @@ export default [
}
return engine;
}
},
},
/* Gecko */
@ -67,7 +67,7 @@ export default [
},
describe(ua) {
const engine = {
name: 'Gecko'
name: 'Gecko',
};
const version = getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, ua);
@ -77,7 +77,7 @@ export default [
}
return engine;
}
},
},
/* Blink */
@ -85,9 +85,9 @@ export default [
test: [/(apple)?webkit\/537\.36/i],
describe() {
return {
name: 'Blink'
name: 'Blink',
};
}
},
},
/* WebKit */
@ -95,7 +95,7 @@ export default [
test: [/(apple)?webkit/i],
describe(ua) {
const engine = {
name: 'WebKit'
name: 'WebKit',
};
const version = getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, ua);
@ -105,6 +105,6 @@ export default [
}
return engine;
}
}
},
},
];

View File

@ -1,5 +1,5 @@
import {
getFirstMatch
getFirstMatch,
} from './utils';
function getWindowsVersionName(version) {
@ -26,9 +26,9 @@ export default [
const version = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua);
return {
name: 'Windows Phone',
version
}
}
version,
};
},
},
/* Windows */
@ -41,9 +41,9 @@ export default [
return {
name: 'Windows',
version,
versionName
versionName,
};
}
},
},
/* macOS */
@ -53,9 +53,9 @@ export default [
const version = getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, ua).replace(/[_\s]/g, '.');
return {
name: 'macOS',
version
version,
};
}
},
},
/* iOS */
@ -66,9 +66,9 @@ export default [
return {
name: 'iOS',
version
version,
};
}
},
},
/* Android */
@ -79,12 +79,12 @@ export default [
return notLikeAndroid && butAndroid;
},
describe(ua) {
const version = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i, ua);
const version = getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, ua);
return {
name: 'Android',
version
version,
};
}
},
},
/* WebOS */
@ -94,9 +94,9 @@ export default [
const version = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i, ua);
return {
name: 'WebOS',
version
version,
};
}
},
},
/* BlackBerry */
@ -109,9 +109,9 @@ export default [
return {
name: 'BlackBerry',
version
version,
};
}
},
},
/* Bada */
@ -122,22 +122,22 @@ export default [
return {
name: 'Bada',
version
version,
};
}
},
},
/* Tizen */
{
test: [/tizen/i],
describe(ua) {
const version = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i, ua);
const version = getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, ua);
return {
name: 'Tizen',
version
version,
};
}
},
},
/* Linux */
@ -145,8 +145,8 @@ export default [
test: [/linux/i],
describe() {
return {
name: 'Linux'
}
}
}
]
name: 'Linux',
};
},
},
];

View File

@ -1,11 +1,11 @@
import {
getFirstMatch
getFirstMatch,
} from './utils';
const TYPES_LABELS = {
tablet: 'tablet',
mobile: 'mobile',
desktop: 'desktop'
desktop: 'desktop',
};
/*
@ -22,7 +22,7 @@ export default [
type: TYPES_LABELS.tablet,
vendor: 'Nexus',
};
}
},
},
/* iPad */
@ -32,9 +32,9 @@ export default [
return {
type: TYPES_LABELS.tablet,
vendor: 'Apple',
model: 'iPad'
}
}
model: 'iPad',
};
},
},
/* Amazon Kindle Fire */
@ -44,9 +44,9 @@ export default [
return {
type: TYPES_LABELS.tablet,
vendor: 'Amazon',
model: 'Kindle Fire HD 7'
}
}
model: 'Kindle Fire HD 7',
};
},
},
/* Another Amazon Tablet with Silk */
@ -55,9 +55,9 @@ export default [
describe() {
return {
type: TYPES_LABELS.tablet,
vendor: 'Amazon'
}
}
vendor: 'Amazon',
};
},
},
/* Tablet */
@ -65,9 +65,9 @@ export default [
test: [/tablet/i],
describe() {
return {
type: TYPES_LABELS.tablet
type: TYPES_LABELS.tablet,
};
}
},
},
/* iPod/iPhone */
@ -82,9 +82,9 @@ export default [
return {
type: TYPES_LABELS.mobile,
vendor: 'Apple',
model: model
model,
};
}
},
},
/* Nexus Mobile */
@ -93,9 +93,9 @@ export default [
describe() {
return {
type: TYPES_LABELS.mobile,
vendor: 'Nexus'
vendor: 'Nexus',
};
}
},
},
/* Mobile */
@ -103,9 +103,9 @@ export default [
test: [/[^-]mobi/i],
describe() {
return {
type: TYPES_LABELS.mobile
type: TYPES_LABELS.mobile,
};
}
},
},
/* BlackBerry */
@ -116,9 +116,9 @@ export default [
describe() {
return {
type: TYPES_LABELS.mobile,
vendor: 'BlackBerry'
vendor: 'BlackBerry',
};
}
},
},
/* Bada */
@ -128,9 +128,9 @@ export default [
},
describe() {
return {
type: TYPES_LABELS.mobile
}
}
type: TYPES_LABELS.mobile,
};
},
},
/* Windows Phone */
@ -141,9 +141,9 @@ export default [
describe() {
return {
type: TYPES_LABELS.mobile,
vendor: 'Microsoft'
}
}
vendor: 'Microsoft',
};
},
},
/* Android Tablet */
@ -154,9 +154,9 @@ export default [
},
describe() {
return {
type: TYPES_LABELS.tablet
}
}
type: TYPES_LABELS.tablet,
};
},
},
/* Android Mobile */
@ -166,9 +166,9 @@ export default [
},
describe() {
return {
type: TYPES_LABELS.mobile
}
}
type: TYPES_LABELS.mobile,
};
},
},
/* desktop */
@ -179,9 +179,9 @@ export default [
describe() {
return {
type: TYPES_LABELS.desktop,
vendor: 'Apple'
vendor: 'Apple',
};
}
},
},
/* Windows */
@ -191,9 +191,9 @@ export default [
},
describe() {
return {
type: TYPES_LABELS.desktop
}
}
type: TYPES_LABELS.desktop,
};
},
},
/* Linux */
@ -203,8 +203,8 @@ export default [
},
describe() {
return {
type: TYPES_LABELS.desktop
}
}
}
type: TYPES_LABELS.desktop,
};
},
},
];

View File

@ -11,7 +11,7 @@ class Parser {
* @constructor
*/
constructor(UA) {
if (UA === void(0) || UA === null || UA === '') {
if (UA === void (0) || UA === null || UA === '') {
throw new Error("UserAgent parameter can't be empty");
}
@ -47,15 +47,13 @@ class Parser {
_parseBrowser() {
this.parsedResult.browser = {};
const browserDescriptor = browserParsersList.find(_browser => {
const browserDescriptor = browserParsersList.find((_browser) => {
if (typeof _browser.test === 'function') {
return _browser.test(this);
}
if (_browser.test instanceof Array) {
return _browser.test.some((condition) => {
return this.test(condition);
});
return _browser.test.some(condition => this.test(condition));
}
throw new Error("Browser's test function is not valid");
@ -133,15 +131,13 @@ class Parser {
_parseOS() {
this.parsedResult.os = {};
const os = osParsersList.find(_os => {
const os = osParsersList.find((_os) => {
if (typeof _os.test === 'function') {
return _os.test(this);
}
if (_os.test instanceof Array) {
return _os.test.some((condition) => {
return this.test(condition);
});
return _os.test.some(condition => this.test(condition));
}
throw new Error("Browser's test function is not valid");
@ -160,7 +156,7 @@ class Parser {
* @return {String} name of the OS macOS, Windows, Linux, etc.
*/
getOSName(toLowerCase) {
const name = this.getOS().name;
const { name } = this.getOS();
if (toLowerCase) {
return String(name).toLowerCase();
@ -197,15 +193,13 @@ class Parser {
_parsePlatform() {
this.parsedResult.platform = {};
const platform = platformParsersList.find(_platform => {
const platform = platformParsersList.find((_platform) => {
if (typeof _platform.test === 'function') {
return _platform.test(this);
}
if (_platform.test instanceof Array) {
return _platform.test.some((condition) => {
return this.test(condition);
});
return _platform.test.some(condition => this.test(condition));
}
throw new Error("Browser's test function is not valid");
@ -238,15 +232,13 @@ class Parser {
_parseEngine() {
this.parsedResult.engine = {};
const engine = enginesParsersList.find(_engine => {
const engine = enginesParsersList.find((_engine) => {
if (typeof _engine.test === 'function') {
return _engine.test(this);
}
if (_engine.test instanceof Array) {
return _engine.test.some((condition) => {
return this.test(condition);
});
return _engine.test.some(condition => this.test(condition));
}
throw new Error("Browser's test function is not valid");

View File

@ -32,7 +32,7 @@ class Utils {
if (regexp.test(ua)) {
return _const;
}
return void(0);
return void (0);
}
}