mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
updated the code to be more clear
This commit is contained in:
parent
42b0f185e2
commit
4d8c781369
@ -590,7 +590,11 @@ const browsersList = [
|
||||
{
|
||||
test: [/.*/i],
|
||||
describe(ua) {
|
||||
const regexp = ua.search('\\(') === -1 ? /^(.*)\/(.*) / : /^(.*)\/(.*)[ \t]\((.*)/;
|
||||
// Define the regexp depending if the ua has device specifications
|
||||
const regexpWithoutParenthesis = /^(.*)\/(.*) /;
|
||||
const regexpWithParenthesis = /^(.*)\/(.*)[ \t]\((.*)/;
|
||||
const hasDeviceSpec = ua.search('\\(') !== -1;
|
||||
const regexp = hasDeviceSpec ? regexpWithoutParenthesis : regexpWithParenthesis;
|
||||
return {
|
||||
name: Utils.getFirstMatch(regexp, ua),
|
||||
version: Utils.getSecondMatch(regexp, ua),
|
||||
|
Loading…
Reference in New Issue
Block a user