Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

hans-user-agent-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hans-user-agent-parser

parser device name, touchable device, device kind

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

hans-user-agent-parser

parser device name, touchable device, device kind

Table of contents

  • Installing
  • Example
  • User agent object

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

Keywords

user-agent

FAQs

Package last updated on 15 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts