@anzerr/agent.util
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

Intro

GitHub Actions status | linter GitHub Actions status | publish GitHub Actions status | test

Parse and fetch info found inside user-agent

Install

npm install --save git+https://git@github.com/anzerr/agent.util.git
npm install --save @anzerr/agent.util

Example

const {UserAgent} = require('@anzerr/agent.util');

const u = new UserAgent();

const agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36';
console.log(u.get(agent), agent);
/*
{
  os: null,
  phone: null,
  tablet: null,
  valid: { tablet: false, phone: false },
  uas: [],
  props: [
    { key: 'Safari', version: '537.36' },
    { key: 'Webkit', version: '537.36' },
    { key: 'Chrome', version: '84.0.4147.105' },
    { key: 'Windows NT', version: '10.0' }
  ],
  utils: [ { key: 'WebKit', version: '537.36' } ]
} Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
*/

Package Sidebar

Install

npm i @anzerr/agent.util

Weekly Downloads

8

Version

1.0.12

License

MIT

Unpacked Size

44.2 kB

Total Files

9

Last publish

Collaborators

  • anzerr