wordwrapimagewriter
Advanced tools
Comparing version 1.0.0 to 1.0.1
11
index.js
@@ -118,3 +118,3 @@ "use strict"; | ||
} else if (times++ > 400) { | ||
console.log("[!] WWIW LOOP ERR! MESSAGE WON'T FIT!!? ", text) || process.exit(1); | ||
console.log("[!] WWIW LOOP ERR! MESSAGE WON'T FIT!!? ", text, "WORDS:", words) || process.exit(1); | ||
} | ||
@@ -128,4 +128,9 @@ | ||
// This one word and can't fit. Pull a character off it | ||
bigwordchararr.unshift(rightmostWord.slice(-1)); | ||
words[words.length - 1] = rightmostWord.substr(0, rightmostWord.length - 1); | ||
if (rightmostWord) { | ||
bigwordchararr.unshift(rightmostWord.slice(-1)); | ||
words[words.length - 1] = rightmostWord.substr(0, rightmostWord.length - 1); | ||
} else { | ||
// word has no more characters. need to move on to next word, was pushed to wontfit | ||
words.pop(); | ||
} | ||
} else { | ||
@@ -132,0 +137,0 @@ // pull a word off of it |
{ | ||
"name": "wordwrapimagewriter", | ||
"private": false, | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "ES6 JS class to write text onto image with word wrapping", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
9286
152