
Research
Security News
Malicious npm Packages Target BSC and Ethereum to Drain Crypto Wallets
Socket uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
@mapbox/mapbox-gl-supported
Advanced tools
A library to determine if a browser supports Mapbox GL JS
@mapbox/mapbox-gl-supported is a utility package that helps developers determine if the current browser environment supports Mapbox GL JS. This is useful for conditionally loading Mapbox GL JS maps or providing fallback content for unsupported browsers.
Check if Mapbox GL JS is supported
This feature allows you to check if the current browser environment supports Mapbox GL JS. If supported, you can proceed to load Mapbox GL JS maps; otherwise, you can provide alternative content.
const mapboxglSupported = require('@mapbox/mapbox-gl-supported');
if (mapboxglSupported()) {
console.log('Mapbox GL JS is supported');
} else {
console.log('Mapbox GL JS is not supported');
}
Check if Mapbox GL JS is supported with specific options
This feature allows you to check if the current browser environment supports Mapbox GL JS with specific options, such as failing if there is a major performance caveat. This can help ensure a better user experience by avoiding loading maps in suboptimal conditions.
const mapboxglSupported = require('@mapbox/mapbox-gl-supported');
const options = { failIfMajorPerformanceCaveat: true };
if (mapboxglSupported(options)) {
console.log('Mapbox GL JS is supported with the given options');
} else {
console.log('Mapbox GL JS is not supported with the given options');
}
The 'detect-browser' package is a lightweight library for detecting the browser name and version. While it does not specifically check for Mapbox GL JS support, it can be used to implement custom logic for browser compatibility, including Mapbox GL JS.
The 'bowser' package is a browser detection library that can identify the browser and its version. Similar to 'detect-browser', it does not directly check for Mapbox GL JS support but can be used to create custom compatibility checks for various features, including Mapbox GL JS.
This library determines if a browser supports Mapbox GL JS.
You may test your browser here.
<script>
tag<script src='mapbox-gl-supported.js'></script>
<script>
if (mapboxgl.supported()) {
...
} else {
...
}
</script>
npm install --save @mapbox/mapbox-gl-supported
var mapboxglSupported = require('@mapbox/mapbox-gl-supported');
if (mapboxglSupported.supported()) {
...
}
FAQs
A library to determine if a browser supports Mapbox GL JS
The npm package @mapbox/mapbox-gl-supported receives a total of 1,145,341 weekly downloads. As such, @mapbox/mapbox-gl-supported popularity was classified as popular.
We found that @mapbox/mapbox-gl-supported demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 28 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 uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
Security News
TC39 advances 9 JavaScript proposals, including Array.fromAsync, Error.isError, and Explicit Resource Management, which are now headed into the ECMAScript spec.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.