Socket
Socket
Sign inDemoInstall

@jimp/plugin-print

Package Overview
Dependencies
Maintainers
2
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jimp/plugin-print - npm Package Compare versions

Comparing version 0.22.10 to 0.22.11--canary.c55989b.0

test/images/with-newlines.png

12

package.json
{
"name": "@jimp/plugin-print",
"version": "0.22.10",
"version": "0.22.11--canary.c55989b.0",
"description": "print an image.",

@@ -24,3 +24,3 @@ "main": "dist/index.js",

"dependencies": {
"@jimp/utils": "^0.22.10",
"@jimp/utils": "0.22.11--canary.c55989b.0",
"load-bmfont": "^1.4.1"

@@ -33,5 +33,5 @@ },

"devDependencies": {
"@jimp/custom": "^0.22.10",
"@jimp/plugin-blit": "^0.22.10",
"@jimp/test-utils": "^0.22.10"
"@jimp/custom": "0.22.11--canary.c55989b.0",
"@jimp/plugin-blit": "0.22.11--canary.c55989b.0",
"@jimp/test-utils": "0.22.11--canary.c55989b.0"
},

@@ -41,3 +41,3 @@ "publishConfig": {

},
"gitHead": "af334eff862cc8091378cd6b1e194086e36d445e"
"gitHead": "c55989b09f4c40aaf607203a2b7069625f1ca590"
}

@@ -19,3 +19,4 @@ export function measureText(font, text) {

export function splitLines(font, text, maxWidth) {
const words = text.split(" ");
const words = text.replace(/[\r\n]+/g, " \n").split(" ");
const lines = [];

@@ -29,3 +30,3 @@ let currentLine = [];

if (length <= maxWidth) {
if (length <= maxWidth && !word.includes("\n")) {
if (length > longestLine) {

@@ -38,8 +39,6 @@ longestLine = length;

lines.push(currentLine);
currentLine = [word];
currentLine = [word.replace("\n", "")];
}
});
lines.push(currentLine);
return {

@@ -46,0 +45,0 @@ lines,

@@ -297,2 +297,16 @@ /* eslint key-spacing: ["error", { "align": "value" }] */

});
it("text with newlines, default alignment", async () => {
const expectedImage = await Jimp.read(
getTestDir(__dirname) + "/images/with-newlines.png"
);
const textImage = await createTextImage(100, 240, Jimp.FONT_SANS_16_BLACK, {
text: "This \nis only \na \ntest.",
maxWidth: 300,
});
expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data);
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc