is-emoji-supported
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -36,12 +36,11 @@ 'use strict'; | ||
var isSupported = (function () { | ||
var ctx = null; | ||
try { | ||
ctx = document.createElement('canvas').getContext('2d'); | ||
} | ||
catch (_a) { } | ||
// Not in browser env | ||
if (typeof document === 'undefined') { | ||
if (!ctx) { | ||
return function () { return false; }; | ||
} | ||
var canvas = document.createElement('canvas'); | ||
// In jest env, canvas has no getContext method | ||
if (!canvas || typeof canvas.getContext !== 'function') { | ||
return function () { return false; }; | ||
} | ||
var ctx = canvas.getContext('2d'); | ||
var CANVAS_HEIGHT = 25; | ||
@@ -48,0 +47,0 @@ var CANVAS_WIDTH = 20; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=new Map;var t=function(){if("undefined"==typeof document)return function(){return!1};var e=document.createElement("canvas");if(!e||"function"!=typeof e.getContext)return function(){return!1};var t=e.getContext("2d");return t.font="12px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=40,t.canvas.height=25,function(e){t.clearRect(0,0,40,25),t.fillStyle="#FF0000",t.fillText(e,0,22),t.fillStyle="#0000FF",t.fillText(e,20,22);for(var n=t.getImageData(0,0,20,25).data,r=n.length,a=0;a<r&&!n[a+3];a+=4);if(a>=r)return!1;var i=20+a/4%20,o=Math.floor(a/4/20),u=t.getImageData(i,o,1,1).data;return n[a]===u[0]&&n[a+2]===u[2]&&!(t.measureText(e).width>=20)}}();exports.isEmojiSupported=function(n){if(e.has(n))return e.get(n);var r=t(n);return e.set(n,r),r},exports.setCacheHandler=function(t){e=t}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=new Map;var e=function(){var t=null;try{t=document.createElement("canvas").getContext("2d")}catch(t){}if(!t)return function(){return!1};return t.font="12px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=40,t.canvas.height=25,function(e){t.clearRect(0,0,40,25),t.fillStyle="#FF0000",t.fillText(e,0,22),t.fillStyle="#0000FF",t.fillText(e,20,22);for(var r=t.getImageData(0,0,20,25).data,a=r.length,n=0;n<a&&!r[n+3];n+=4);if(n>=a)return!1;var i=20+n/4%20,l=Math.floor(n/4/20),o=t.getImageData(i,l,1,1).data;return r[n]===o[0]&&r[n+2]===o[2]&&!(t.measureText(e).width>=20)}}();exports.isEmojiSupported=function(r){if(t.has(r))return t.get(r);var a=e(r);return t.set(r,a),a},exports.setCacheHandler=function(e){t=e}; | ||
//# sourceMappingURL=is-emoji-supported.min.js.map |
@@ -34,12 +34,11 @@ /** | ||
var isSupported = (function () { | ||
var ctx = null; | ||
try { | ||
ctx = document.createElement('canvas').getContext('2d'); | ||
} | ||
catch (_a) { } | ||
// Not in browser env | ||
if (typeof document === 'undefined') { | ||
if (!ctx) { | ||
return function () { return false; }; | ||
} | ||
var canvas = document.createElement('canvas'); | ||
// In jest env, canvas has no getContext method | ||
if (!canvas || typeof canvas.getContext !== 'function') { | ||
return function () { return false; }; | ||
} | ||
var ctx = canvas.getContext('2d'); | ||
var CANVAS_HEIGHT = 25; | ||
@@ -46,0 +45,0 @@ var CANVAS_WIDTH = 20; |
@@ -40,12 +40,11 @@ (function (global, factory) { | ||
var isSupported = (function () { | ||
var ctx = null; | ||
try { | ||
ctx = document.createElement('canvas').getContext('2d'); | ||
} | ||
catch (_a) { } | ||
// Not in browser env | ||
if (typeof document === 'undefined') { | ||
if (!ctx) { | ||
return function () { return false; }; | ||
} | ||
var canvas = document.createElement('canvas'); | ||
// In jest env, canvas has no getContext method | ||
if (!canvas || typeof canvas.getContext !== 'function') { | ||
return function () { return false; }; | ||
} | ||
var ctx = canvas.getContext('2d'); | ||
var CANVAS_HEIGHT = 25; | ||
@@ -52,0 +51,0 @@ var CANVAS_WIDTH = 20; |
@@ -1,2 +0,2 @@ | ||
var e,t;e=this,t=function(e){"use strict";var t=new Map,n=function(){if("undefined"==typeof document)return function(){return!1};var e=document.createElement("canvas");if(!e||"function"!=typeof e.getContext)return function(){return!1};var t=e.getContext("2d");return t.font="12px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=40,t.canvas.height=25,function(e){t.clearRect(0,0,40,25),t.fillStyle="#FF0000",t.fillText(e,0,22),t.fillStyle="#0000FF",t.fillText(e,20,22);for(var n=t.getImageData(0,0,20,25).data,r=n.length,a=0;a<r&&!n[a+3];a+=4);if(a>=r)return!1;var i=20+a/4%20,o=Math.floor(a/4/20),f=t.getImageData(i,o,1,1).data;return n[a]===f[0]&&n[a+2]===f[2]&&!(t.measureText(e).width>=20)}}();e.isEmojiSupported=function(e){if(t.has(e))return t.get(e);var r=n(e);return t.set(e,r),r},e.setCacheHandler=function(e){t=e},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).isSupportedEmoji={}); | ||
var e,t;e=this,t=function(e){"use strict";var t=new Map,n=function(){var e=null;try{e=document.createElement("canvas").getContext("2d")}catch(e){}return e?(e.font="12px Arial, Sans-Serif",e.textBaseline="top",e.canvas.width=40,e.canvas.height=25,function(t){e.clearRect(0,0,40,25),e.fillStyle="#FF0000",e.fillText(t,0,22),e.fillStyle="#0000FF",e.fillText(t,20,22);for(var n=e.getImageData(0,0,20,25).data,a=n.length,r=0;r<a&&!n[r+3];r+=4);if(r>=a)return!1;var i=20+r/4%20,o=Math.floor(r/4/20),f=e.getImageData(i,o,1,1).data;return n[r]===f[0]&&n[r+2]===f[2]&&!(e.measureText(t).width>=20)}):function(){return!1}}();e.isEmojiSupported=function(e){if(t.has(e))return t.get(e);var a=n(e);return t.set(e,a),a},e.setCacheHandler=function(e){t=e},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).isSupportedEmoji={}); | ||
//# sourceMappingURL=is-emoji-supported.min.js.map |
{ | ||
"name": "is-emoji-supported", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Detect if the current device support the specified emoji", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/is-emoji-supported.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24454
290