How to use caniuse-api - 10 common examples

To help you get started, we’ve selected a few caniuse-api 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 agauniyal / vscode-caniuse / src / method.js View on Github external
function caniuse() {
  const feature = getSelectedText();
  if (feature === '') { return ''; }

  let result = {};
  try {
    result = api.getSupport(feature);
  } catch (e) {
    const suggestions = utils.provideMatches(feature);
    if (suggestions.length === 0) {
      vscode.window.showErrorMessage('Cannot find property in local database, you can still search through status bar.');
    } else {
      // returns promise based string
      return utils.pickSuggestions(suggestions);
    }
  }
  const showAll = vscode.workspace.getConfiguration('caniuse').show_all;
  // returns actual string
  return utils.statusBuilder(result, !showAll);
}
github sylvainpolletvillard / postcss-grid-kiss / dist / main.js View on Github external
module.exports = function (options) {
	options = Object.assign({}, DEFAULTS_OPTIONS, options);

	var browsers = browserslist(options.browsers);
	var isFallbackNeeded = !caniuse.isSupported("css-grid", browsers);
	var isIEHackNeeded = !caniuse.isSupported("css-supports-api", browsers);

	if (options.hasOwnProperty("fallback")) {
		isFallbackNeeded = options.fallback;
		isIEHackNeeded = options.fallback;
	}

	return function (css, result) {
		css.walkDecls('grid-kiss', function (decl) {

			var input = parse(decl, options);
			var grid = { props: new Map(), rule: decl.parent };
			var zones = [];
			var indent = decl.raws.before.match(/.*$/)[0];
			var nameMapping = new Map();
github angular / angular-cli / packages / angular_devkit / build_angular / src / utils / differential-loading.ts View on Github external
export function isEs5SupportNeeded(projectRoot: string): boolean {
  const browsersList: string[] = browserslist(
    undefined, {
      path: projectRoot,
    });

  return !caniuse.isSupported('es6-module', browsersList.join(', '));
}
github xing / hops / packages / config / lib / postcss-necsst.js View on Github external
if (!conditions.length || conditions.find(function (condition) {
      return !isSupported(condition, options.browsers);
    })) {
      processor.use(require(feature)(
github Automattic / wp-calypso / packages / calypso-build / webpack / minify.js View on Github external
function chooseTerserEcmaVersion( browsers ) {
	if ( ! caniuse.isSupported( 'arrow-functions', browsers ) ) {
		return 5;
	}
	if ( ! caniuse.isSupported( 'es6-class', browsers ) ) {
		return 5;
	}

	return 6;
}
github sylvainpolletvillard / postcss-grid-kiss / dist / main.js View on Github external
module.exports = function (options) {
	options = Object.assign({}, DEFAULTS_OPTIONS, options);

	var browsers = browserslist(options.browsers);
	var isFallbackNeeded = !caniuse.isSupported("css-grid", browsers);
	var isIEHackNeeded = !caniuse.isSupported("css-supports-api", browsers);

	if (options.hasOwnProperty("fallback")) {
		isFallbackNeeded = options.fallback;
		isIEHackNeeded = options.fallback;
	}

	return function (css, result) {
		css.walkDecls('grid-kiss', function (decl) {

			var input = parse(decl, options);
			var grid = { props: new Map(), rule: decl.parent };
			var zones = [];
			var indent = decl.raws.before.match(/.*$/)[0];
			var nameMapping = new Map();

			grid.props.set("display", "grid");
github open-wc / open-wc / packages / es-dev-server / src / utils / user-agent-compat.js View on Github external
  return moduleFeatures.every(ft => caniuse.isSupported(ft, browserTarget));
}
github jallajs / jalla / lib / document.js View on Github external
/**
     * The following transforms are prepended in reverse order to ensure that
     * they come _before_ possible custom html head elements
     */

    if (app.env === 'development') {
      d.transform(prependToHead, `
        
        
      `)
    } else {
      const script = app.context.assets.get('bundle.js')
      const styles = app.context.assets.get('bundle.css')
      const features = process.env.POLYFILL_FEATURES

      if (!caniuse.isSupported('link-rel-preload', app.browsers.join(','))) {
        d.transform(prependToHead, `

caniuse-api

request the caniuse data to check browsers compatibilities

MIT
Latest version published 6 years ago

Package Health Score

70 / 100
Full package analysis