updated the code to be more clear

pull/310/head
Ricardo Rauber Pereira 5 years ago
parent 42b0f185e2
commit 4d8c781369

@ -590,7 +590,11 @@ const browsersList = [
{ {
test: [/.*/i], test: [/.*/i],
describe(ua) { 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 { return {
name: Utils.getFirstMatch(regexp, ua), name: Utils.getFirstMatch(regexp, ua),
version: Utils.getSecondMatch(regexp, ua), version: Utils.getSecondMatch(regexp, ua),

Loading…
Cancel
Save