Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
caniuse-on-user-agent
Advanced tools
Given a User-Agent string, find out whether a browser feature is supported
A small module that takes a User-Agent string and a caniuse.com feature ID, and returns support for that feature by the given user agent.
Keep in mind that user agent detection is inherently messy, so this module will sometimes fail or even return incorrect data. Do not rely on this module in order to detect what features to enable or polyfill. Also note that this package depends on caniuse-lite, and hence can result in code size that may not be desirable for your use case.
This project also includes TypeScript type definitions.
npm install caniuse-on-user-agent
import { canIUseOnUserAgent } from 'caniuse-on-user-agent';
canIUseOnUserAgent(
'fetch',
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0',
);
//=> 'y'
canIUseOnUserAgent(featureId: string, userAgent: string): string | null
featureId
The ID of a specific feature as used on caniuse.com.
userAgent
The User-Agent string of the browser for which you want to check if the given feature is supported.
If no data on the given browser was found, this function returns null
.
Otherwise, it returns the browser support as reported by caniuse-lite, e.g. y
if the feature is fully supported, a x
if it is partially supported with a vendor prefix, or n
when it is not supported. Note that it also may include footnotes, e.g. a x #1 #3
.
browserToCaniuseId(browserInfo: BrowserInfo): string | null
browserInfo
A browser name, OS and version as reported by detect-browser.
If no ID for the given browser is known, this function returns null
.
Otherwise, it returns the user agent ID in the format used by caniuse.com.
See CHANGELOG.md
.
MIT © Vincent Tunru
FAQs
Given a User-Agent string, find out whether a browser feature is supported
We found that caniuse-on-user-agent 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.