How to use the caniuse-api.getSupport function in caniuse-api

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 una / caniuse-component / src / scripts.js View on Github external
supportCall() {
    return caniuse.getSupport(this.name);
  }
github robinweser / inline-style-prefixer / modules / generator / generateDynamicPrefixMap.js View on Github external
export default function generateDynamicPrefixMap(browserList: Object): Object {
  const prefixMap = {}

  for (let i = 0, len = browsers.length; i < len; ++i) {
    const browser = browsers[i]
    if (!prefixMap.hasOwnProperty(browser)) {
      prefixMap[browser] = {}
    }

    for (const keyword in propertyMap) {
      const keywordProperties = [].concat(propertyMap[keyword])
      const versions = getSupport(keyword)

      for (let j = 0, kLen = keywordProperties.length; j < kLen; ++j) {
        if (versions[browser].x >= browserList[browser]) {
          prefixMap[browser][keywordProperties[j]] = versions[browser].x
        }
      }
    }
  }

  prefixMap.ie = {
    ...prefixMap.ie,
    ...prefixMap.ie_mob,
  }

  delete prefixMap.ie_mob
github robinweser / inline-style-prefixer / generator / generatePrefixData.js View on Github external
function gatherInformation() {
	let prefixProperties = {
		ie: {},
		firefox: {},
		safari: {},
		chrome: {},
		opera : {}
	};

	let search;
	for (search in searchMap) {
		let properties = searchMap[search];
		let versions = caniuse.getSupport(search, true);
		if (properties instanceof Array !== true) {
			properties = [properties];
		}
		properties.forEach(prop => {
			let prefix;
			for (prefix in prefixProperties) {
				prefixProperties[prefix][prop] = versions[prefix].x
			}
		});
	}
	return 'var prefixes = ' + JSON.stringify(prefixProperties) + '; module.exports = prefixes';

}
github robinweser / inline-style-prefixer / generator / generateData.js View on Github external
function gatherInformation() {
  const prefixProperties = { }
  browsers.forEach(function(browser) {
    prefixProperties[browser] = { }
  })

  for (const search in searchMap) {
    let properties = searchMap[search]
    const versions = caniuse.getSupport(search, true)
    if (properties instanceof Array !== true) {
      properties = [ properties ]
    }
    properties.forEach(function(prop) {
      for (const prefix in prefixProperties) {
        if (versions[prefix].x >= config[prefix]) {
          prefixProperties[prefix][prop] = versions[prefix].x
        }
      }
    })
  }

  prefixProperties.ie = assign({ }, prefixProperties.ie, prefixProperties.ie_mob)
  delete prefixProperties.ie_mob
  flexPropsIE.forEach(function(prop) {
    delete prefixProperties.ie[prop]
github CoderMageFox / alfredMagic / CanIUse / caniuse.js View on Github external
preciseQuery(input){
        let response =  CanIUse.getSupport(input);
        let FormattedResult = this.FormatResults(response);
        return {
            title: input,
            subtitle: FormattedResult,
            arg: input
        }
    }
github agauniyal / vscode-caniuse / src / utils.js View on Github external
.then(pickedItem => {
        try {
          result = api.getSupport(pickedItem);
        } catch (e) {
          return reject(e.message);
        }
        const showAll = vscode.workspace.getConfiguration('caniuse').show_all;
        const stringToRet = statusBuilder(result, !showAll);
        resolve(stringToRet);
      });
  });

caniuse-api

request the caniuse data to check browsers compatibilities

MIT
Latest version published 6 years ago

Package Health Score

73 / 100
Full package analysis