3rd-Eden / useragent

Useragent parser for Node.js, ported from browserscope.org
MIT License
898 stars 139 forks source link

Opera is not recognised when using 'is' #58

Closed slavab89 closed 9 years ago

slavab89 commented 9 years ago

When trying to identify the following user-agent (from Opera) i get different results

Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60

Using parse i get:

{ family: 'Opera',
  major: '26',
  minor: '0',
  patch: '1656',
  source: 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60' }

Using is i get:

{ chrome: true,
  firefox: false,
  ie: false,
  mobile_safari: false,
  mozilla: false,
  opera: false,
  safari: false,
  webkit: true,
  android: false,
  version: '537.36' }
3rd-Eden commented 9 years ago

The is method is not as advanced as parsing. It just uses a regexp to extract some minor data form the userstring and does a best effort in guessing (as also stated in the readme: https://github.com/3rd-Eden/useragent#useragentisuseragent-stringbrowsername)

The method is just there for legacy reasons. I'm accepting pull requests to improve it, but i'm not going to improve it my self as it works as described.