Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Created August 11, 2023 18:08
Show Gist options
  • Save wbamberg/3ef0ac22a874a9e98d9243512bcb71f8 to your computer and use it in GitHub Desktop.
Save wbamberg/3ef0ac22a874a9e98d9243512bcb71f8 to your computer and use it in GitHub Desktop.
import bcd from "@mdn/browser-compat-data" assert { type: "json" };
const support = bcd.webextensions.api;
function checkSupport(api, browser) {
let total = Object.keys(support[api]).length;
let supported = 0;
for (const feature of Object.keys(support[api])) {
if (support[api][feature]["__compat"]) {
if (
support[api][feature]["__compat"]["support"][browser][
"version_added"
] !== false
) {
supported++;
}
}
}
return {
supported,
total,
};
}
for (const api of Object.keys(support)) {
const { supported, total } = checkSupport(api, "firefox_android");
console.log(`${api}:
${supported} out of ${total}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment