1.0.4 • Published 3 years ago

hans-user-agent-parser v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

hans-user-agent-parser

parser device name, touchable device, device kind

Table of contents

Installing Add the package to your project

npm i hans-user-agent-parser

using yarn

yarn add hans-user-agent-parser

Example

Export ua from hans-user-agent-parser

const ua = require('hans-user-agent-parser')

using TypeScript

import ua from 'hans-user-agent-parser'
const userAgent = ua()

User agent object

console.log(userAgent) //

{
    device: 'desktop', //on of them ['desktop', 'tablet', 'mobile']
    touchableDevice: boolean, //true if device has touch events
    deviceName: 'macintosh' // on of device names
}

Device names

Desktop

  • macintosh
  • windows
  • linux

Tablet

  • ipad
  • ipod
  • x11

Mobile

  • iphone
  • android
  • blackerry
  • mini
  • iemobile