caniuse-lite icon indicating copy to clipboard operation
caniuse-lite copied to clipboard

Add detailed usage into the markdown files

Open tokyojava opened this issue 1 year ago • 1 comments

Hi there, I am considering adding some hands-on code usage to your repo as I find reading textual description quite hard. If you think it is good, I am gonna create a PR for the README.md file

const lite = require('caniuse-lite');

// get agent usage data
console.log(lite.agents.ie); //this can apply to chrome, firefox

// get feature support as per browser
// check the support of "acc" feature
// you need to get the compressed data first
const aac = lite.features["aac"];
// use the feature method to get the uncompressed data
const parsedAac = lite.feature(aac);
console.log(parsedAac);

// get per region data
// you need to get the compressed data first 
const chinaData = require("caniuse-lite/data/regions/CN");
// use the region method to get the uncompressed data
console.log(lite.region(chinaData));

tokyojava avatar Jul 22 '24 15:07 tokyojava

Yes, please. An example is a great additional to API.

ai avatar Jul 22 '24 15:07 ai