Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
compute-baseline
Advanced tools
A library for computing web-features statuses from browser compatibility data
compute-baseline
By the W3C WebDX Community Group and contributors.
compute-baseline
computes preliminary Baseline statuses from @mdn/browser-compat-data
feature keys.
You can use compute-baseline
to help you find interoperable web platform features, propose new web-features
features, or compare support between features.
compute-baseline
also provides utility classes for working with @mdn/browser-compat-data
generally.
If you need authoritative Baseline statuses, check out the web-features
package instead.
Don't use compute-baseline
to generate publishable Baseline statuses for arbitrary web platform features.
The results of compute-baseline
invocations have not received editorial review.
Strictly speaking, a Baseline status requires editorial review, so statuses generated by compute-baseline
are tentative.
If you need authoritative Baseline statuses, check out the web-features
package instead.
You can use compute-baseline
to explore possibilities or do error correction.
For example, you might use compute-baseline
to hide a Baseline status, when showing a broader feature's status might be misleading.
If you're not sure whether your application fits with the definition of Baseline, please file an issue.
To use this package, you'll need:
To install the package, run:
npm install --save compute-baseline
If you wish to specify which version of @mdn/browser-compat-data
(or manage its upgrades explicitly, such as with Dependabot), then install the latest @mdn/browser-compat-data
too.
Run:
npm install --save @mdn/browser-compat-data@latest
import { computeBaseline } from "compute-baseline";
computeBaseline({
compatKeys: [
"javascript.builtins.AsyncFunction",
"javascript.builtins.AsyncFunction.AsyncFunction",
"javascript.operators.async_function",
"javascript.operators.await",
"javascript.statements.async_function",
],
});
Returns:
{
baseline: 'high',
baseline_low_date: '2017-04-05',
baseline_high_date: '2019-10-05',
discouraged: false,
support: Map(7) { … }
toJSON: [Function: toJSON]
}
Use the toJSON()
method to get a web-features
-like plain JSON representation of the status.
Sometimes it can be helpful to know if parent features have less support than the specific feature you're checking (for example, the parent is behind a prefix or flag) when computing a status for a deeply-nested feature.
This is typically most interesting when checking a single key.
Use the withAncestors
option:
import { computeBaseline } from "compute-baseline";
computeBaseline({
compatKeys: ["api.Notification.body"],
withAncestors: true,
});
If you don't want to import @mdn/browser-compat-data
as your data source, you can bring your own schema-compatible compat data.
import data from "some-parsed-json-file";
import { computeBaseline } from "compute-baseline";
import { Compat } from "compute-baseline/browser-compat-data";
const compat = new Compat(data);
computeBaseline(
{
compatKeys: ["css.properties.border-color"],
},
compat,
);
compute-baseline
is part of the W3C WebDX Community Group's web-features project.
Go to web-platform-dx/web-features for more information on contributing or getting help.
FAQs
A library for computing web-features statuses from browser compatibility data
The npm package compute-baseline receives a total of 946 weekly downloads. As such, compute-baseline popularity was classified as not popular.
We found that compute-baseline demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.