Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
feature-matrix
Advanced tools
A library for displaying a product's browser version requirements based on the underlying features
The repo and documentation are still a work in progress and aren't at version 1 yet. We'll improve this over time.
FeatureMatrix is a JavaScript library for rendering feature support matrices that look like this:
(TODO: put a screenshot here)
Rather than having to explicitly define the browsers that are supported by particular features, FeatureMatrix dynamically queries the caniuse dataset to determine what browsers are supported. Features can:
Blacklisting/whitelisting is provided as a fallback for cases where there's no alternative (for example, if a browser is marked as supporting the web standards you require but there's a bug that's breaking things).
FeatureMatrix is available on npm as feature-matrix.
In your requirements file:
{
"features": {
"a-feature": {
"humanReadableName": "An Amazing Feature",
"requiredBrowserFeatures": [
"caniuse:svg",
"caniuse:webgl"
]
},
"another-feature": {
"humanReadableName": "A Legacy Feature",
"requiredBrowserPlugins": [
"Flash 9+"
],
"blacklist": [
"IE 6-7"
]
}
}
}
In your JS:
// 'path/to/requirements.json' could also be an Object containing the requirements
FeatureMatrix.loadRequirements('path/to/requirements.json', function (err, reqs) {
if (err) {
handleError(err);
} else {
var fm = new FeatureMatrix('#mountpoint', reqs);
}
});
All strings (including those used to indicate success/failure) can be changed using an options argument to the FeatureMatrix
constructor. The plugin requirement text is configured using a function that returns the requirement string for that plugin to provide maximum flexibility.
FeatureMatrix.loadRequirements('path/to/requirements.json', function (err, reqs) {
// TODO: you should add error checking here
var fm = new FeatureMatrix('#mountpoint', reqs, {
supportedText: 'yes',
unsupportedText: 'no',
unknownText: '???',
featureColumnLabel: 'Capability',
// this is a lot nicer if you have ES6 arrow functions and template strings
pluginRequirementGenerator: function (plugin, version) {
return 'Requires the installation of ' + plugin + ' ' + version;
}
});
});
FAQs
A library for displaying a product's browser version requirements based on the underlying features
The npm package feature-matrix receives a total of 0 weekly downloads. As such, feature-matrix popularity was classified as not popular.
We found that feature-matrix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.