is-emoji-supported
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -40,7 +40,8 @@ 'use strict'; | ||
} | ||
var ctx = document.createElement('canvas').getContext('2d'); | ||
// In jest env, ctx is null | ||
if (!ctx) { | ||
var canvas = document.createElement('canvas'); | ||
// In jest env, canvas has no getContext method | ||
if (!canvas || !Object.prototype.hasOwnProperty('getContext')) { | ||
return function () { return false; }; | ||
} | ||
var ctx = canvas.getContext('2d'); | ||
var CANVAS_HEIGHT = 25; | ||
@@ -47,0 +48,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").getContext("2d");if(!e)return function(){return!1};return 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 r=e.getImageData(0,0,20,25).data,n=r.length,a=0;a<n&&!r[a+3];a+=4);if(a>=n)return!1;var i=20+a/4%20,u=Math.floor(a/4/20),o=e.getImageData(i,u,1,1).data;return r[a]===o[0]&&r[a+2]===o[2]&&!(e.measureText(t).width>=20)}}();exports.isEmojiSupported=function(r){if(e.has(r))return e.get(r);var n=t(r);return e.set(r,n),n},exports.setCacheHandler=function(t){e=t}; | ||
"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||!Object.prototype.hasOwnProperty("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 r=t.getImageData(0,0,20,25).data,n=r.length,a=0;a<n&&!r[a+3];a+=4);if(a>=n)return!1;var o=20+a/4%20,i=Math.floor(a/4/20),u=t.getImageData(o,i,1,1).data;return r[a]===u[0]&&r[a+2]===u[2]&&!(t.measureText(e).width>=20)}}();exports.isEmojiSupported=function(r){if(e.has(r))return e.get(r);var n=t(r);return e.set(r,n),n},exports.setCacheHandler=function(t){e=t}; | ||
//# sourceMappingURL=is-emoji-supported.min.js.map |
@@ -38,7 +38,8 @@ /** | ||
} | ||
var ctx = document.createElement('canvas').getContext('2d'); | ||
// In jest env, ctx is null | ||
if (!ctx) { | ||
var canvas = document.createElement('canvas'); | ||
// In jest env, canvas has no getContext method | ||
if (!canvas || !Object.prototype.hasOwnProperty('getContext')) { | ||
return function () { return false; }; | ||
} | ||
var ctx = canvas.getContext('2d'); | ||
var CANVAS_HEIGHT = 25; | ||
@@ -45,0 +46,0 @@ var CANVAS_WIDTH = 20; |
@@ -44,7 +44,8 @@ (function (global, factory) { | ||
} | ||
var ctx = document.createElement('canvas').getContext('2d'); | ||
// In jest env, ctx is null | ||
if (!ctx) { | ||
var canvas = document.createElement('canvas'); | ||
// In jest env, canvas has no getContext method | ||
if (!canvas || !Object.prototype.hasOwnProperty('getContext')) { | ||
return function () { return false; }; | ||
} | ||
var ctx = canvas.getContext('2d'); | ||
var CANVAS_HEIGHT = 25; | ||
@@ -51,0 +52,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").getContext("2d");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,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=e.getImageData(i,o,1,1).data;return n[a]===f[0]&&n[a+2]===f[2]&&!(e.measureText(t).width>=20)}):function(){return!1}}();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(){if("undefined"==typeof document)return function(){return!1};var e=document.createElement("canvas");if(!e||!Object.prototype.hasOwnProperty("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 o=20+a/4%20,i=Math.floor(a/4/20),f=t.getImageData(o,i,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={}); | ||
//# sourceMappingURL=is-emoji-supported.min.js.map |
{ | ||
"name": "is-emoji-supported", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
25690
294
0