# device-detector

> Detect device info on Node.js and Browser

Latest version **1.0.2** (published 2017-12-06) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install device-detector
pnpm add device-detector
yarn add device-detector
bun add device-detector
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-12-06 |
| First published | 2015-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 6.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | @ndaidong |
| Maintainers | ndaidong |
| Keywords | device, client, browser, navigator, detector, util |

## Links

- npm: https://www.npmjs.com/package/device-detector
- Repository: https://github.com/ndaidong/device-detector
- Homepage: https://www.npmjs.com/package/device-detector
- Issues: https://github.com/ndaidong/device-detector/issues
- npm.io page: https://npm.io/package/device-detector

## Dependencies (1)

- [bellajs](https://npm.io/package/bellajs.md) 7.x.x

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-12-06
- 1.0.1 — 2017-08-07
- 1.0.0 — 2017-06-04
- 0.1.32 — 2016-04-01
- 0.1.18 — 2015-12-24
- 0.1.17 — 2015-12-10
- 0.1.16 — 2015-11-13
- 0.1.12 — 2015-11-11
- 0.0.8 — 2015-09-25
- 0.0.7 — 2015-09-25
- 0.0.6 — 2015-09-23
- 0.0.5 — 2015-09-23
- 0.0.4 — 2015-09-23
- 0.0.3 — 2015-09-23

## README

device-detector
========

Simple tool for detecting device info and bots.

[![NPM](https://badge.fury.io/js/device-detector.svg)](https://badge.fury.io/js/device-detector)
[![Build Status](https://travis-ci.org/ndaidong/device-detector.svg?branch=master)](https://travis-ci.org/ndaidong/device-detector)
[![codecov](https://codecov.io/gh/ndaidong/device-detector/branch/master/graph/badge.svg)](https://codecov.io/gh/ndaidong/device-detector)
[![Dependency Status](https://gemnasium.com/badges/github.com/ndaidong/device-detector.svg)](https://gemnasium.com/github.com/ndaidong/device-detector)
[![NSP Status](https://nodesecurity.io/orgs/techpush/projects/b9b9775a-ee09-4491-afe1-028f58e0b2fd/badge)](https://nodesecurity.io/orgs/techpush/projects/b9b9775a-ee09-4491-afe1-028f58e0b2fd)


## Setup

- Node.js

  ```
  npm install device-detector
  ```

- CDN

  - [DeviceDetector.js](https://cdn.rawgit.com/ndaidong/device-detector/master/dist/DeviceDetector.js)
  - [DeviceDetector.min.js](https://cdn.rawgit.com/ndaidong/device-detector/master/dist/DeviceDetector.min.js)
  - [DeviceDetector.min.map](https://cdn.rawgit.com/ndaidong/device-detector/master/dist/DeviceDetector.min.map)

- 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)

---
_Source: https://npm.io/package/device-detector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
