check-browser
Ultra-thin wrapper around bowser with simple declarative interface
Last updated 5 years ago by ashaffer88 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install check-browser 
SYNC missed versions from official npm registry.

check-browser

Ultra-thin wrapper around bowser with simple declarative interface

Usage

check-browser takes a single argument, a map of browser names to minimum version numbers, and returns a boolean value indicating whether or not the current browser is equal to or greater than one of the allowed ones. The browser names it uses are the same as bowser's keys:

  • chrome
  • safari
  • msie
  • opera
  • seamonkey
  • blackberry
  • bada
  • tizen
  • sailfish
  • android
  • windowsphone
  • ios (iphone / ipad / ipod)
  • firefoxos
  • webos

(not all of these are browsers, I know, but they will all work)

You may also use the others property to toggle whitelist/blacklist behavior. If others is true, browsers not explicitly listed will be considered valid. others defaults to false.

check-browser is also forgiving about capitalization, chrome/Chrome/CHROME, are all acceptable.

Examples

checkBrowser({
  msie: 7,
  chrome: 10,
  firefox: 3
});
checkBrowser({chrome: 33}) // Returns false for Firefox
checkBrowser({chrome: 33, others: true}) // Returns true for Firefox

Current Tags

  • 0.1.7                                ...           latest (5 years ago)

8 Versions

  • 0.1.7                                ...           5 years ago
  • 0.1.6                                ...           5 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |