How to use the mdn-browser-compat-data.browsers function in mdn-browser-compat-data

To help you get started, we’ve selected a few mdn-browser-compat-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github connorshea / mdn-compat-data-explorer / lib / build.js View on Github external
// 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'
github webhintio / hint / packages / utils-compat-data / scripts / mdn-browser-compat-data.js View on Github external
/**
 * 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;
github Siteimprove / alfa / packages / alfa-compatibility / scripts / browsers.js View on Github external
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;
    }