1
0
mirror of https://github.com/lancedikson/bowser synced 2026-09-23 12:34:58 +00:00

Add an engines parser

This commit is contained in:
Denis Demchenko
2017-06-09 23:04:43 +03:00
parent c3ad15e0ff
commit a794b10797
3 changed files with 157 additions and 19 deletions

View File

@@ -29,13 +29,6 @@ import {
} from './utils';
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
const RENDERING_ENGINES_NAMES = {
blink: 'Blink',
webkit: 'WebKit',
gecko: 'Gecko',
presto: 'Presto',
edgehtml: 'EdgeHTML'
};
const browsersList = [
{
@@ -177,7 +170,6 @@ const browsersList = [
return {
name: 'Microsoft Edge',
engine: 'EdgeHTML',
version
}
}
@@ -199,7 +191,6 @@ const browsersList = [
const version = getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua);
return {
name: 'SeaMonkey',
engine: RENDERING_ENGINES_NAMES.gecko,
version
}
}
@@ -210,7 +201,6 @@ const browsersList = [
const version = getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.?_?\d+)+)/i, ua);
return {
name: 'Firefox',
engine: RENDERING_ENGINES_NAMES.gecko,
version
}
}
@@ -317,16 +307,9 @@ const browsersList = [
test: [/chrome|crios|crmo/i],
describe(ua) {
const version = getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua);
let engine;
if (/(apple)?webkit\/537\.36/i.test(ua)) {
engine = RENDERING_ENGINES_NAMES.blink;
} else {
engine = RENDERING_ENGINES_NAMES.webkit;
}
return {
name: 'Chrome',
engine,
version
}
}
@@ -357,7 +340,6 @@ const browsersList = [
return {
name: 'Safari',
engine: RENDERING_ENGINES_NAMES.webkit,
version
}
}