How to use the caniuse-db/data.json.data function in caniuse-db

To help you get started, we’ve selected a few caniuse-db 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 GoogleChromeLabs / pptraas.com / helpers / gsearch.js View on Github external
*
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author ebidel@ (Eric Bidelman)
 */

// Adapted from https://github.com/GoogleChromeLabs/puppeteer-examples/blob/master/google_search_features.js.

/* global document */

const fs = require('fs');
const caniuseDB = require('caniuse-db/data.json').data;

const GOOGLE_SEARCH_CHROME_VERSION = process.env.CHROME_VERSION || 41;

/* eslint-disable quote-props */
const BlinkFeatureNameToCaniuseName = {
  AddEventListenerPassiveTrue: 'passive-event-listener',
  AddEventListenerPassiveFalse: 'passive-event-listener',
  PromiseConstructor: 'promises',
  PromiseResolve: 'promises',
  PromiseReject: 'promises',
  V8PromiseChain: 'promises',
  DocumentRegisterElement: 'custom-elements',
  V0CustomElementsRegisterHTMLCustomTag: 'custom-elements',
  V0CustomElementsCreateCustomTagElement: 'custom-elements',
  V0CustomElementsRegisterHTMLTypeExtension: 'custom-elements',
  V0CustomElementsCreateTypeExtensionElement: 'custom-elements',
github mozilla-frontend-infra / firefox-health-dashboard / src / status / caniuse.js View on Github external
result[platform].version = version;
            }
            return false;
          }),
        )(versions);
      });
      const firefoxRef = find({ caniuse_ref: ref })(firefoxStatus);
      if (firefoxRef) {
        result.firefox.ref = firefoxRef.slug;
      }
      return result;
    }),
    map(scoreFeature),
    filter(({ completeness }) => completeness < 4 && completeness >= 0.5),
    // filter(({ recency }) => recency >= 0.5)
  )(caniuse.data);
}
github mozilla-frontend-infra / firefox-health-dashboard / src / status / chrome.js View on Github external
if (firefoxRef.firefox_version) {
          result.firefox.version = firefoxRef.firefox_version;
        }
      } else if (/show_bug\.cgi/.test((ff && ff.view.url) || '')) {
        const id = ff.view.url.match(/id=([^$#]+)/)[1];
        queuedIds.push({
          id: id,
          feature: result,
        });
      }
      let caniuseRef = findKey({ chrome_id: chromestatus.id })(caniuse.data);
      if (!caniuseRef && firefoxRef && firefoxRef.caniuse_ref) {
        caniuseRef = firefoxRef.caniuse_ref;
      }
      if (caniuseRef) {
        const ref = caniuse.data[caniuseRef];
        result.caniuse = {
          ref: caniuseRef,
          usage: ref.usage_perc_y + ref.usage_perc_a,
        };
      }
      return result;
    }),
  )(chromeStatus);
github mozilla-frontend-infra / firefox-health-dashboard / src / status / chrome.js View on Github external
result.name = firefoxRef.title;
        result.firefox.ref = firefoxRef.slug;
        result.firefox.status = resolveStatus(firefoxRef.firefox_status);
        result.safari.status = resolveStatus(firefoxRef.webkit_status);
        result.ie.status = resolveStatus(firefoxRef.ie_status);
        if (firefoxRef.firefox_version) {
          result.firefox.version = firefoxRef.firefox_version;
        }
      } else if (/show_bug\.cgi/.test((ff && ff.view.url) || '')) {
        const id = ff.view.url.match(/id=([^$#]+)/)[1];
        queuedIds.push({
          id: id,
          feature: result,
        });
      }
      let caniuseRef = findKey({ chrome_id: chromestatus.id })(caniuse.data);
      if (!caniuseRef && firefoxRef && firefoxRef.caniuse_ref) {
        caniuseRef = firefoxRef.caniuse_ref;
      }
      if (caniuseRef) {
        const ref = caniuse.data[caniuseRef];
        result.caniuse = {
          ref: caniuseRef,
          usage: ref.usage_perc_y + ref.usage_perc_a,
        };
      }
      return result;
    }),
  )(chromeStatus);
github puppeteer / examples / google_search_features.js View on Github external
* limitations under the License.
 *
 * @author ebidel@ (Eric Bidelman)
 */

/**
 * Prints a non-exhaustive list of HTML/JS/CSS features a page is using which
 * are not supported by the Google Search bot and "Render as Google"
 * (runs Chrome 41). See developers.google.com/search/docs/guides/rendering.
 */

const fs = require('fs');
const puppeteer = require('puppeteer');
const fetch = require('node-fetch');
const chalk = require('chalk');
const caniuseDB = require('caniuse-db/data.json').data;

const url = process.env.URL || 'https://www.chromestatus.com/features';

const GOOGLE_SEARCH_CHROME_VERSION = process.env.CHROME_VERSION || 41;

const BlinkFeatureNameToCaniuseName = {
  AddEventListenerPassiveTrue: 'passive-event-listener',
  AddEventListenerPassiveFalse: 'passive-event-listener',
  PromiseConstructor: 'promises',
  PromiseResolve: 'promises',
  PromiseReject: 'promises',
  V8PromiseChain: 'promises',
  DocumentRegisterElement: 'custom-elements',
  V0CustomElementsRegisterHTMLCustomTag: 'custom-elements',
  V0CustomElementsCreateCustomTagElement: 'custom-elements',
  V0CustomElementsRegisterHTMLTypeExtension: 'custom-elements',