1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

Merge pull request #310 from ricardorauber/master

Update the regexp for generic browsers
This commit is contained in:
Denis Demchenko
2019-04-24 21:28:27 +03:00
committed by GitHub
2 changed files with 23 additions and 2 deletions

View File

@@ -606,9 +606,17 @@ const browsersList = [
{
test: [/.*/i],
describe(ua) {
/* Here we try to make sure that there are explicit details about the device
* in order to decide what regexp exactly we want to apply
* (as there is a specific decision based on that conclusion)
*/
const regexpWithoutDeviceSpec = /^(.*)\/(.*) /;
const regexpWithDeviceSpec = /^(.*)\/(.*)[ \t]\((.*)/;
const hasDeviceSpec = ua.search('\\(') !== -1;
const regexp = hasDeviceSpec ? regexpWithDeviceSpec : regexpWithoutDeviceSpec;
return {
name: Utils.getFirstMatch(/^(.*)\/(.*) /, ua),
version: Utils.getSecondMatch(/^(.*)\/(.*) /, ua),
name: Utils.getFirstMatch(regexp, ua),
version: Utils.getSecondMatch(regexp, ua),
};
},
},