Skip to content

Instantly share code, notes, and snippets.

@WebReflection
Last active July 12, 2019 15:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WebReflection/384a7f99d6ab53e39e557a908b7909a8 to your computer and use it in GitHub Desktop.
Save WebReflection/384a7f99d6ab53e39e557a908b7909a8 to your computer and use it in GitHub Desktop.
A simple script that tells you if a feature is available for a list of browsers
#!/usr/bin/env node
var browsers = [
'chrome 49',
'edge 16',
'firefox 51',
'opera 36'
].join(', ');
var caniuse = require('caniuse-api');
switch (process.argv.length) {
case 3:
var found = [].concat(caniuse.find(process.argv[2]));
found.forEach(function (feature) {
console.log(feature + ': ' + (caniuse.isSupported(feature, browsers) ? '🍾 \x1B[1myup\x1B[0m 🎉' : 'nope'));
});
if (found.length < 1) console.log('not at all');
break;
default:
console.log('you need to specify a feature');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment