Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/jorishermans/chopperjs
- Owner: jorishermans
- Created: 2016-08-05T13:07:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-30T10:27:24.000Z (over 8 years ago)
- Last Synced: 2024-10-13T14:28:33.904Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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()
});
});
```