Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// const payload = {
// api: compatData.api,
// browsers: compatData.browsers,
// css: compatData.css,
// html: compatData.html,
// http: compatData.http,
// javascript: compatData.javascript,
// mathml: compatData.mathml,
// svg: compatData.svg,
// webdriver: compatData.webdriver,
// webextensions: compatData.webextensions
// }
const payload = {
api: compatData.api,
browsers: compatData.browsers,
css: compatData.css,
html: compatData.html,
http: compatData.http,
javascript: compatData.javascript,
mathml: compatData.mathml,
svg: compatData.svg,
webdriver: compatData.webdriver,
webextensions: compatData.webextensions
}
fs.writeFile(
path.resolve(
__dirname,
'..',
'public',
'data.json'
/**
* Strip browser details down to name only.
*
* @param {bcd.Browsers} browsers
*/
const removeBrowserDetails = (browsers) => {
for (const browserName of Object.keys(browsers)) {
browsers[browserName] = /** @type {any} */({ name: browsers[browserName].name });
}
};
// Remove unnecessary data
const data = {
browsers: mdn.browsers,
css: mdn.css,
html: mdn.html
};
// TODO: drop `browsers` after `hint-compat-api` uses new util methods.
removeBrowserDetails(data.browsers);
removeFeatures(data.css);
removeFeatures(data.html);
const code = `/* eslint-disable */
import { Browsers, PrimaryIdentifier } from 'mdn-browser-compat-data/types';
type Data = {
browsers: Browsers;
css: PrimaryIdentifier;
html: PrimaryIdentifier;
const fs = require("fs");
const prettier = require("prettier");
const data = require("mdn-browser-compat-data");
/**
* @type {Array}
*/
const include = ["chrome", "edge", "firefox", "ie", "opera", "safari"];
const { keys } = Object;
const browsers = [];
for (const name of include) {
const browser = data.browsers[name];
const releases = [];
for (const version of keys(browser.releases)) {
const { status, release_date } = browser.releases[version];
switch (status) {
case "beta":
case "nightly":
case "planned":
continue;
}
if (release_date === undefined) {
continue;
}