connect-categorizr

2.0.0 • Public • Published

connect-categorizr Build Status

Connect middleware that provides device detection, based on Brett Jankord's Categorizr.

Installation

npm install connect-categorizr

Options

  • useSession: Store the device type in the session for quicker lookups on subsequent requests. Defaults to true.

Usage

var connect = require('connect'),
    categorizr = require('connect-categorizr');
 
var app = connect();
app.use(categorizr());

The middleware will add the following immutable properties to the req object:

  • deviceType: String containing the matched device type (mobile, tablet, desktop or tv)
  • isMobile: true if the device is a phone
  • isTablet: true if the device is a tablet
  • isDesktop: true if the device is a desktop browser
  • isTV: true if the device is a TV

Testing

First, install the test dependencies

npm install -d

and then run the tests

make test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    8
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    8
  • 1.2.0
    0
  • 1.1.0
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i connect-categorizr

Weekly Downloads

5

Version

2.0.0

License

none

Unpacked Size

1.52 MB

Total Files

19

Last publish

Collaborators

  • davidwood