npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-browser-compat-data

v1.0.5

Published

Useful to check a JS methods browser compatibility

Downloads

11

Readme

js-browser-compat-data

Checks JS browsers compatibilities based on mdn-browser-compat-data

NPM Downloads

Installation

$ npm i js-browser-compat-data

Usage

const jsCompat = require('js-browser-compat-data');
// or
import * as jsCompat from 'js-browser-compat-data';

jsCompat.find('includes'); // ['builtins.Array.includes','builtins.String.includes','builtins.TypedArray.includes']
jsCompat.getSupport('builtins.Array.includes');
jsCompat.isSupported('builtins.Array.includes', 'ie'); //false
jsCompat.minimumSupportedVersion('builtins.Array.includes', 'chrome'); //47
jsCompat.getStatus('builtins.Array.includes'); // { experimental: false, standard_track: true, deprecated: false }
jsCompat.getMDNLink('builtins.Array.includes'); // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
jsCompat.allFeatures(); // ['builtins.Array.concat', 'builtins.Array.copyWithin', 'builtins.Array.entries', ...]

API

jsCompat.find(searchKey)

get all the methods for the particular search key

Returns an array of all available JS methods with the given search key. If none of them matches, it returns an empty array.

jsCompat.find('includes');
/*
['builtins.Array.includes', 'builtins.String.includes', 'builtins.TypedArray.includes']
*/

jsCompat.getSupport(feature)

ask since which browser version the feature is available

Returns an array of object containing the support for the most used browsers. If the feature name is incorrect, it returns an empty array

jsCompat.getSupport('builtins.Array.includes');
/*
[
  { chrome: { support: true, version: '47' } },
  { chrome_android: { support: true, version: '47' } },
  { edge: { support: true, version: '14' } },
  { firefox: { support: true, version: '43' } },
  { firefox_android: { support: true, version: '43' } },
  { ie: { support: false } },
  { nodejs: { support: true, version: '6.0.0' } },
  { opera: { support: true, version: '34' } },
  { opera_android: { support: true, version: '34' } },
  { safari: { support: true, version: '9' } },
  { safari_ios: { support: true, version: '9' } },
  { samsunginternet_android: { support: true, version: '5.0' } },
  { webview_android: { support: true, version: '47' } }
]
*/

jsCompat.isSupported(feature, browser)

ask if the feature is supported in a particular browser. The list of browsers are shown above in the previous example

Returns true if the feature is supported, else it returns false.

jsCompat.isSupported('builtins.Array.includes', 'ie'); // false
jsCompat.isSupported('builtins.Array.includes', 'chrome'); // true

jsCompat.minimumSupportedVersion(feature, browser)

get the minium version of the browser that supports the feature

Returns the supported version, if supported, else return false.

jsCompat.minimumSupportedVersion('builtins.Array.includes', 'chrome'); //47
jsCompat.minimumSupportedVersion('builtins.Array.includes', 'ie'); //false

jsCompat.getStatus(feature)

get the current status of the feature, if it is experimental or deprecated or used as standard

Returns an object of all these three properties with true/false for each property. Returns and empty object if there is no such feature.

jsCompat.getStatus('builtins.Array.includes');
/*
{ experimental: false, standard_track: true, deprecated: false }
*/

jsCompat.getMDNLink(feature)

gets the link to the mdn page for the feature

Returns the URL as the response, else returns empty string if there is no such feature.

jsCompat.getMDNLink('builtins.Array.includes');
/*
https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
*/

jsCompat.allFeatures()

lists all the features that are available in JS

Returns an array of all the available features in JS.

jsCompat.allFeatures();
// ['builtins.Array.concat', 'builtins.Array.copyWithin', 'builtins.Array.entries', ...]

Issues?

If you find a problem, please file a bug.

Note

Though this can be used as a client package, we recommend you to use this as a Node package as it will be in sync with the MDN DB.

Changelog

License

Buy me a coffee