Socket
Socket
Sign inDemoInstall

device-detector

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

device-detector

Detect device info on Node.js and Browser


Version published
Weekly downloads
995
increased by30.07%
Maintainers
1
Weekly downloads
 
Created
Source

device-detector

Simple tool for detecting device info and bots.

NPM Build Status codecov Dependency Status NSP Status

Setup

  • Node.js

    npm install device-detector
    
  • CDN

  • Also supports ES6 Module, CommonJS, AMD and UMD style.

Usage

DeviceDetector provides just one method named parse().

DeviceDetector.parse([userAgent]);

The only parameter "userAgent" is optional in web browser, but required in Node.js environment.

Example:

var ua = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
var deviceInfo = DeviceDetector.parse(ua);

deviceInfo is an object looks like this:

  {
    type: 'Bot',
    browser: '',
    engine: 'Googlebot',
    version: '2.1',
    os: ''
  }

Test

git clone https://github.com/ndaidong/device-detector.git
cd device-detector
npm install
npm test

License

The MIT License (MIT)

Keywords

FAQs

Package last updated on 06 Dec 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc