Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
caniuse-lite
Advanced tools
The caniuse-lite npm package is a lighter version of the full caniuse database, which provides up-to-date browser support tables for front-end web technologies. It is used for checking the compatibility of web features in different browsers and browser versions.
Browser support data retrieval
Retrieve browser support data for a specific feature, such as CSS flexbox.
const caniuse = require('caniuse-lite');
const featureData = caniuse.feature(caniuse.features.flexbox);
console.log(featureData);
Browser usage statistics
Get usage statistics for different versions of a specific browser, like Chrome.
const caniuse = require('caniuse-lite');
const browserStats = caniuse.getBrowserUsageByVersion('chrome');
console.log(browserStats);
Data for browser versions
Retrieve a list of versions for a given browser, such as Firefox.
const caniuse = require('caniuse-lite');
const versions = caniuse.getVersions('firefox');
console.log(versions);
Region-based browser usage statistics
Get browser usage statistics for a specific region, like the United States.
const caniuse = require('caniuse-lite');
const regionUsage = caniuse.getRegion('US');
console.log(regionUsage);
The browserslist package allows you to declare the browsers you want to support using queries in a .browserslistrc file or package.json. It is used by tools like Autoprefixer, eslint-plugin-compat, and others to determine which browser versions to support when transpiling or linting code. It differs from caniuse-lite by focusing on defining a list of browsers for tooling rather than providing raw compatibility data.
The compat-table package provides data on JavaScript language features and their support across different engines and runtime environments. It is similar to caniuse-lite in that it provides compatibility data, but it focuses specifically on ECMAScript features rather than broader web technologies.
The mdn-browser-compat-data package is a collection of JSON files containing compatibility data for web technologies as provided by the Mozilla Developer Network (MDN). It is similar to caniuse-lite in providing compatibility data but is sourced from MDN documentation and covers a wider range of web technologies, including APIs, CSS, HTML, HTTP, SVG, and more.
A smaller version of caniuse-db, with only the essentials!
The full data behind Can I use is incredibly useful for any front end developer, and on the website all of the details from the database are displayed to the user. However in automated tools, many of these fields go unused; it's not a problem for server side consumption but client side, the less JavaScript that we send to the end user the better.
caniuse-lite then, is a smaller dataset that keeps essential parts of the data
in a compact format. It does this in multiple ways, such as converting null
array entries into empty strings, representing support data as an integer rather
than a string, and using base62 references instead of longer human-readable
keys.
This packed data is then reassembled (via functions exposed by this module) into a larger format which is mostly compatible with caniuse-db, and so it can be used as an almost drop-in replacement for caniuse-db for contexts where size on disk is important; for example, usage in web browsers. The API differences are very small and are detailed in the section below.
import * as lite from 'caniuse-lite';
lite.agents
caniuse-db provides a full data.json
file which contains all of the features
data. Instead of this large file, caniuse-lite provides this data subset
instead, which has the browser
, prefix
, prefix_exceptions
, usage_global
and versions
keys from the original.
In addition, the subset contains the release_date
key with release dates (as timestamps) for each version:
{
"release_date": {
"6": 998870400,
"7": 1161129600,
"8": 1237420800,
"9": 1300060800,
"10": 1346716800,
"11": 1381968000,
"5.5": 962323200
}
}
lite.feature(js)
The feature
method takes a file from data/features
and converts it into
something that more closely represents the caniuse-db
format. Note that only
the title
, stats
and status
keys are kept from the original data.
lite.features
The features
index is provided as a way to query all of the features that
are listed in the caniuse-db
dataset. Note that you will need to use the
feature
method on values from this index to get a human-readable format.
lite.region(js)
The region
method takes a file from data/regions
and converts it into
something that more closely represents the caniuse-db
format. Note that only
the usage data is exposed here (the data
key in the original files).
Thanks goes to these wonderful people (emoji key):
Ben Briggs 💻 📖 👀 ⚠️ | Andy Jansson 💻 | Andrey Sitnik 💻 | Igor Deryabin 💻 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
The data in this repo is available for use under a CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/). For attribution just mention somewhere that the source is caniuse.com. If you have any questions about using the data for your project please contact me here: http://a.deveria.com/contact
FAQs
A smaller version of caniuse-db, with only the essentials!
The npm package caniuse-lite receives a total of 37,563,572 weekly downloads. As such, caniuse-lite popularity was classified as popular.
We found that caniuse-lite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.