Socket
Socket
Sign inDemoInstall

@mapbox/mapbox-gl-supported

Package Overview
Dependencies
0
Maintainers
28
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 3.0.0

66

index.js

@@ -20,11 +20,5 @@ 'use strict';

if (!isBrowser()) return 'not a browser';
if (!isArraySupported()) return 'insufficent Array support';
if (!isFunctionSupported()) return 'insufficient Function support';
if (!isObjectSupported()) return 'insufficient Object support';
if (!isJSONSupported()) return 'insufficient JSON support';
if (!isWorkerSupported()) return 'insufficient worker support';
if (!isUint8ClampedArraySupported()) return 'insufficient Uint8ClampedArray support';
if (!isArrayBufferSupported()) return 'insufficient ArrayBuffer support';
if (!isCanvasGetImageDataSupported()) return 'insufficient Canvas/getImageData support';
if (!isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat)) return 'insufficient WebGL support';
if (!isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat)) return 'insufficient WebGL2 support';
if (!isNotIE()) return 'insufficient ECMAScript 6 support';

@@ -37,44 +31,2 @@ }

function isArraySupported() {
return (
Array.prototype &&
Array.prototype.every &&
Array.prototype.filter &&
Array.prototype.forEach &&
Array.prototype.indexOf &&
Array.prototype.lastIndexOf &&
Array.prototype.map &&
Array.prototype.some &&
Array.prototype.reduce &&
Array.prototype.reduceRight &&
Array.isArray
);
}
function isFunctionSupported() {
return Function.prototype && Function.prototype.bind;
}
function isObjectSupported() {
return (
Object.keys &&
Object.create &&
Object.getPrototypeOf &&
Object.getOwnPropertyNames &&
Object.isSealed &&
Object.isFrozen &&
Object.isExtensible &&
Object.getOwnPropertyDescriptor &&
Object.defineProperty &&
Object.defineProperties &&
Object.seal &&
Object.freeze &&
Object.preventExtensions
);
}
function isJSONSupported() {
return 'JSON' in window && 'parse' in JSON && 'stringify' in JSON;
}
function isWorkerSupported() {

@@ -105,13 +57,2 @@ if (!('Worker' in window && 'Blob' in window && 'URL' in window)) {

// IE11 only supports `Uint8ClampedArray` as of version
// [KB2929437](https://support.microsoft.com/en-us/kb/2929437)
function isUint8ClampedArraySupported() {
return 'Uint8ClampedArray' in window;
}
// https://github.com/mapbox/mapbox-gl-supported/issues/19
function isArrayBufferSupported() {
return ArrayBuffer.isView;
}
// Some browsers or browser extensions block access to canvas data to prevent fingerprinting.

@@ -153,6 +94,3 @@ // Mapbox GL uses this API to load sprites and images in general.

return (
canvas.getContext('webgl', attributes) ||
canvas.getContext('experimental-webgl', attributes)
);
return canvas.getContext('webgl2', attributes);
}

@@ -159,0 +97,0 @@

2

mapbox-gl-supported.js

@@ -1,1 +0,1 @@

!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).mapboxgl=e()}(function(){return function n(o,i,a){function f(t,e){if(!i[t]){if(!o[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(u)return u(t,!0);throw(r=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",r}r=i[t]={exports:{}},o[t][0].call(r.exports,function(e){return f(o[t][1][e]||e)},r,r.exports,n,o,i,a)}return i[t].exports}for(var u="function"==typeof require&&require,e=0;e<a.length;e++)f(a[e]);return f}({1:[function(e,t,r){"use strict";function n(e){return!o(e)}function o(e){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(r);try{e=new Worker(r),t=!0}catch(e){t=!1}e&&e.terminate();return URL.revokeObjectURL(r),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;t=t.getImageData(0,0,1,1);return t&&t.width===e.width}()?function(e){void 0===i[e]&&(i[e]=function(e){var t,e=function(e){var t=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.getContext("webgl",r)||t.getContext("experimental-webgl",r)}(e);if(!e)return!1;try{t=e.createShader(e.VERTEX_SHADER)}catch(e){return!1}return!(!t||e.isContextLost())&&(e.shaderSource(t,"void main() {}"),e.compileShader(t),!0===e.getShaderParameter(t,e.COMPILE_STATUS))}(e));return i[e]}(e&&e.failIfMajorPerformanceCaveat)?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support":"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support"}r.supported=n,r.notSupportedReason=o;var i={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}]},{},[1])(1)});
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).mapboxgl=e()}(function(){return function r(o,i,u){function a(t,e){if(!i[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(f)return f(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=i[t]={exports:{}},o[t][0].call(n.exports,function(e){return a(o[t][1][e]||e)},n,n.exports,r,o,i,u)}return i[t].exports}for(var f="function"==typeof require&&require,e=0;e<u.length;e++)a(u[e]);return a}({1:[function(e,t,n){"use strict";function r(e){return!o(e)}function o(e){var t,n;return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return;var t,e,n=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(n);try{e=new Worker(n),t=!0}catch(e){t=!1}e&&e.terminate();return URL.revokeObjectURL(n),t}()?((t=document.createElement("canvas")).width=t.height=1,(n=(n=t.getContext("2d"))&&n.getImageData(0,0,1,1))&&n.width===t.width?function(e){void 0===i[e]&&(i[e]=function(e){var t,e=function(e){var t=document.createElement("canvas"),n=Object.create(r.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=e,t.getContext("webgl2",n)}(e);if(!e)return!1;try{t=e.createShader(e.VERTEX_SHADER)}catch(e){return!1}return!(!t||e.isContextLost())&&(e.shaderSource(t,"void main() {}"),e.compileShader(t),!0===e.getShaderParameter(t,e.COMPILE_STATUS))}(e));return i[e]}(e&&e.failIfMajorPerformanceCaveat)?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support":"insufficient Canvas/getImageData support"):"insufficient worker support"}n.supported=r,n.notSupportedReason=o;var i={};r.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}]},{},[1])(1)});
{
"name": "@mapbox/mapbox-gl-supported",
"version": "2.0.1",
"version": "3.0.0",
"description": "A library to determine if a browser supports Mapbox GL JS",

@@ -27,6 +27,6 @@ "main": "index.js",

"browserify": "^17.0.0",
"eslint": "^8.1.0",
"eslint": "^8.23.0",
"eslint-config-mourner": "^2.0.1",
"uglify-js": "^3.14.2"
"uglify-js": "^3.17.4"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc