Last active
July 12, 2019 15:16
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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