-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read properties of undefined (reading 'reduce') #79
Comments
will: var result = {chars: []}; fix the issue? Do you have reproduction that can be added to the unit tests? |
let msg = "Jonathan";
figlet(msg, {
font: "sam3kr",
horizontalLayout: 'default',
verticalLayout: "universal smushing",
width: 8,
whitespaceBreak: true
}, function (err, text) {
//my callback
}); With a width under 15, it throws an error like above. |
@patorjk Just found this issue again, in my browser history. I will try to check why the error happen. If it's my feature I will check what I can do to fix it. But there is a need for decision, I don't remember what old code did.
I myself think (when I use the code) that it should return empty string or throw an error. I can use one or the other in my code. I prefer empty string so I can just wrap with try..catch the return empty string on error. |
The empty string solution sounds good to me. |
@Lev-Shapiro did you delete your comment? |
Yes, I don't know if you still have that problem, for now I'm working on another feature in this repo. If you still have this problem - tell me, so I'd know it's status because 2 years it's quite a long peiod any many stuff could already change |
I found the same issue(#73), but it is closed.
I examined the code, then found a few things.
generateFigTextLines
,nextFigChars.chars
becomes undefined; It is because ofbreakWord
.nextFigChars.chars
is undefined,joinFigArray
throws an Error.The first thing is a more significant problem.
The code looks like this:
The return value,
result
, is sometimes not fully initialized.The text was updated successfully, but these errors were encountered: