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

how-caniuse

v1.0.1

Published

Query caniuse db and get all information related to browser compatibility.

Downloads

5

Readme

how-caniuse

Query the caniuse-db to check browsers compatibilities.

Installation

$ npm install how-caniuse --save

Usage

const howcaniuse = require('how-caniuse');

howcaniuse.getCompleteDataset('border-image')
howcaniuse.getSupport('border-image')
howcaniuse.isSupported('border-image', 'ie 8, chrome 52')
howcaniuse.searchFeature('css3')
howcaniuse.getLatestStableBrowsers()
howcaniuse.getBrowserScope

API

howcaniuse.getSupport(feature)

Find since which browsers versions a feature is available

  • y - (Y)es, supported by default
  • a - (A)lmost supported (aka Partial support)
  • n - (N)o support, or disabled by default
  • p - No support, but has (P)olyfill
  • u - Support (u)nknown
  • x - Requires prefi(x) to work
  • d - (D)isabled by default (need to enable flag or something in browser settings)
howcaniuse.getSupport('css-grid')
/*
    {
    "title":"CSS Grid Layout",
    "browsers":
    {
        "ie":{"n":8,"a":11,"x":11,"p":9},
        "edge":{"a":15,"x":15},
        "firefox":{"y":52,"n":18,"p":51,"d":51},
        "chrome":{"y":57,"n":24,"p":56,"d":56},
        "safari":{"y":"TP","n":5.1,"p":10},
        "opera":{"y":44,"n":27,"p":43,"d":43},
        "ios_saf":{"n":5.1,"p":10.2},
        "op_mini":{"n":"all"},
        "android":{"n":4.1,"p":53},
        "bb":{"n":10},
        "op_mob":{"n":12.1,"p":37},
        "and_chr":{"p":56},
        "and_ff":{"p":51},
        "ie_mob":{"a":11,"x":11},
        "and_uc":{"n":11},
        "samsung":{"p":4},
        "and_qq":{"p":1.2,"d":1.2}
        }
   }
*/

howcaniuse.isSupported(feature, browsers)

Find if a feature is supported by some browsers

howcaniuse.isSupported('border-image', 'ie 8, ie 9, edge 14, chrome 58, firefox 50')
/*
{ 'border-image':
   { 'ie 8': 'n',
     'ie 9': 'n',
     'edge 14': 'y',
     'chrome 58': 'a',
     'firefox 50': 'y' } }
*/

howcaniuse.searchFeature(feature)

Search for a caniuse feature name and it returns list of all available features

Ex:

howcaniuse.searchFeature('border') // [ 'border-image', 'border-radius' ]
howcaniuse.searchFeature('xyz') // [] returns an empty array if there are no results
howcaniuse.searchFeature('font')
/*
[ 'fontface',
  'font-feature',
  'svg-fonts',
  'font-loading',
  'font-unicode-range',
  'css-font-stretch',
  'font-size-adjust',
  'font-smooth',
  'font-kerning',
  'font-variant-alternates',
  'css-font-rendering-controls' ]
*/

howcaniuse.getLatestStableBrowsers()

Get the list of all stable browsers

howcaniuse.getLatestStableBrowsers()
/*
  [ { browser: 'IE', type: 'desktop', stableVersion: '11' },
  { browser: 'Edge', type: 'desktop', stableVersion: '15' },
  { browser: 'Firefox', type: 'desktop', stableVersion: '54' },
  { browser: 'Chrome', type: 'desktop', stableVersion: '59' },
  { browser: 'Safari', type: 'desktop', stableVersion: 'TP' },
  { browser: 'Opera', type: 'desktop', stableVersion: '45' },
  { browser: 'iOS Safari', type: 'mobile', stableVersion: '10.0-10.2' },
  { browser: 'Opera Mini', type: 'mobile', stableVersion: 'all' },
  { browser: 'Android Browser', type: 'mobile', stableVersion: '53' },
  { browser: 'Blackberry Browser', type: 'mobile', stableVersion: '10' },
  { browser: 'Opera Mobile', type: 'mobile', stableVersion: '37' },
  { browser: 'Chrome for Android', type: 'mobile', stableVersion: '56' },
  { browser: 'Firefox for Android', type: 'mobile', stableVersion: '51' },
  { browser: 'IE Mobile', type: 'mobile', stableVersion: '11' },
  { browser: 'UC Browser for Android', type: 'mobile', stableVersion: '11' },
  { browser: 'Samsung Internet', type: 'mobile', stableVersion: '4' },
  { browser: 'QQ Browser', type: 'mobile', stableVersion: '1.2' } ]
*/

howcaniuse.getBrowserScope()

Returns a list of all browsers available out there

howcaniuse.getBrowserScope()
/*
[ { browser: 'IE',
    prefix: 'ms',
    type: 'desktop',
    versions: [ '5.5', '6', '7', '8', '9', '10', '11' ] },
  { browser: 'Edge',
    prefix: 'ms',
    type: 'desktop',
    versions: [ '12', '13', '14', '15' ] },
  ....
*/

License