New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@flourish/pocket-knife

Package Overview
Dependencies
Maintainers
9
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flourish/pocket-knife - npm Package Compare versions

Comparing version

to
0.3.2

2

package.json
{
"name": "@flourish/pocket-knife",
"version": "0.3.1",
"version": "0.3.2",
"description": "Flourish module with handy tools",

@@ -5,0 +5,0 @@ "main": "pocket-knife.js",

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

### 0.3.2
* Change `this` in `getTextWidth()`
### 0.3.1

@@ -2,0 +5,0 @@ * Export `getTextWidth()`

@@ -1,8 +0,9 @@

function getTextWidth(text, font) {
var canvas = this.canvas || (this.canvas = document.createElement("canvas"));
var context = canvas.getContext("2d");
context.font = font || "10px sans-serif";
var metrics = context.measureText(text);
return metrics.width;
}
var getTextWidth = (function() {
var context = document.createElement("canvas").getContext("2d");
return function(text, font) {
context.font = font || "10px sans-serif";
var metrics = context.measureText(text);
return metrics.width;
};
})();

@@ -9,0 +10,0 @@ function isImage(string) {