Sunday, 4 June 2017

Is there a good NodeJS module or JavaScript library for parsing device from User Agent?

I've tried a node module ua-parser-js, but it doesn't parse my device:

> const parser = require('ua-parser-js');
> parser(ua)
{ ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
  browser: { name: 'Chrome', version: '58.0.3029.110', major: '58' },
  engine: { version: '537.36', name: 'WebKit' },
  os: { name: 'Mac OS', version: '10.12.5' },
  device: { model: undefined, vendor: undefined, type: undefined },
  cpu: { architecture: undefined } }

I need something that would detect the device here (Intel Macintosh) and for most user agent strings.

Thanks!



via Sergey

No comments:

Post a Comment