Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jorishermans/chopperjs

A modern device detection package for node.js
https://github.com/jorishermans/chopperjs

Last synced: 10 days ago
JSON representation

A modern device detection package for node.js

Awesome Lists containing this project

README

        

# chopperjs

Chopperjs is a modern device detection framework that uses node.js.
It detects a mobile, tablet and desktop device in the browser and on the server.

## basic example

```javascript
var chopper = require('chopperjs');

var device = new chopper.DeviceDetect();
console.log(device.isDesktop());
console.log(device.isTablet());
console.log(device.isMobile());
```

## serverside example

You can use this device detection functionality in your express.js application like below.

```javascript
var chopper = require('chopperjs');

...

app.get('/', (req, res) => {
var device = new chopper.DeviceDetect({req: req});
res.render('index', {
title: 'chopperjs example',
mobile: device.isMobile(),
tablet: device.isTablet(),
desktop: device.isDesktop()
});
});
```