node-caniuse
Check your JavaScript against the Can I Use database
Quick Start
npm install node-caniuse
var caniuse = ; ;
API Reference
caniuse(Object options [, Function callback])
-> Promise
The result (for both the resolved Promise and for the callback) is an Array where each element represents a file and it's bad tokens.
"filename" : "path/to/file" "tokens" : token: "<invalid token>" location: ...
Note: The callback and the promise are equivalent and can be used interchangeably.
option.files
> Type: Array
String
Default: []
The files to be scanned by caniuse
. Both the String
and Array
versions accept globs. E.g. ./src/**/*.js
options.browsers
> Type: Object
Default: {}
An object representing your browser support matrix in the following format:
browser versions can be specified in the following three ways:
- Direct selection -
[9, 10, 11]
or'11'
- Versions newer than -
'> 9'
or'>= 8'
- Versions with Global Usage greater than -
'> 10%'
browser names can be any of the following (case insensitive):
Android
for old Android stock browser.BlackBerry
orbb
for Blackberry browser.Chrome
for Google Chrome.Firefox
orff
for Mozilla Firefox.Explorer
orie
orInternetExplorer
for Internet Explorer.iOS
orios_saf
for iOS Safari.Opera
for Opera.Safari
for desktop Safari.OperaMobile
orop_mob
for Opera Mobile.OperaMini
orop_mini
for Opera Mini.ChromeAndroid
orand_chr
for Chrome for Android (mostly same as commonChrome
).FirefoxAndroid
orand_ff
for Firefox for Android.ExplorerMobile
orie_mob
for Internet Explorer Mobile.
reporter
> Type: String
Default: null
Specify the output format by choosing any of the node-caniuse reporters
;
gobalIgnores
> Type: Array
Default: []
Ignore tokens that are properties of of the specified objects. This is helpful if you have libraries that act as polyfills for native behavior.
;