caniuse-api
request the caniuse data to check browsers compatibilities
Installation
$ yarn add caniuse-api
Usage
const caniuse = require('caniuse-api')
caniuse.getSupport('border-radius')
caniuse.isSupported('border-radius', 'ie 8, ie 9')
caniuse.setBrowserScope('> 5%, last 1 version')
caniuse.getSupport('border-radius')
API
caniuse.getSupport(feature)
ask since which browsers versions a feature is available
y
: Since which browser version the feature is availablen
: Up to which browser version the feature is unavailablea
: Up to which browser version the feature is partially supportedx
: Up to which browser version the feature is prefixed
caniuse.getSupport('border-radius', true)
caniuse.isSupported(feature, browsers)
ask if a feature is supported by some browsers
caniuse.isSupported('border-radius', 'ie 8, ie 9')
caniuse.isSupported('border-radius', 'ie 9')
caniuse.find(query)
search for a caniuse feature name
Ex:
caniuse.find('radius')
caniuse.find('nothingness')
caniuse.find('css3')
caniuse.getLatestStableBrowsers()
get the current version for each browser
caniuse.getLatestStableBrowsers()
caniuse.getBrowserScope()
returns a list of browsers currently used for the scope of operations
caniuse.getBrowserScope()
caniuse.setBrowserScope(browserscope)
if you do not like the default browser scope, you can set it globally by using this method
- browserscope should be a 'autoprefixer' formatted string
caniuse.setBrowserScope('> 5%, last 2 versions, Firefox ESR, Opera 12.1')