connect-categorizr
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 totrue
.
Usage
var connect = categorizr = ; var app = ;app;
The middleware will add the following immutable properties to the req
object:
deviceType
: String containing the matched device type (mobile
,tablet
,desktop
ortv
)isMobile
:true
if the device is a phoneisTablet
:true
if the device is a tabletisDesktop
:true
if the device is a desktop browserisTV
:true
if the device is a TV
Testing
First, install the test dependencies
npm install -d
and then run the tests
make test