Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

connect-categorizr

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-categorizr

Connect middleware for device detection based on Categorizr

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
96
81.13%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

connect

FAQs

Package last updated on 08 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts