Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

browser-check

NoumanSaleem7MIT0.0.0

Check if client browser matches rules defined with semver syntax

express, middleware, browsers, ie8

readme

browser-support

Check if client browser matches rules defined with semver syntax in Node.js

Installation

$ npm install browser-check

Examples

Redirect users using IE versions below 8 using Express.js

var browserCheck = require('browser-check');
app.use(function (req, res, next) {
    var unsupported = browserCheck(req.headers['user-agent'], { "IE": "<8" });
    if (unsupported) return res.redirect('http://google.com');
    next();
});