patorjk / figlet.js

A FIG Driver written in JavaScript which aims to fully implement the FIGfont spec.
MIT License
2.61k stars 167 forks source link

Question: Why doesn't figlet return the new text and why is error the first parameter of the callback? #100

Open coolCucumber-cat opened 1 year ago

coolCucumber-cat commented 1 year ago

It's not a big deal but you would expect that that it would return the new text, especially if you want to save it in a variable. And for 90% of people, that first parameter of the callback is going to stay greyed out. No one is going to have custom error handling in case the text can't look nice. Just throw an error and have an optional parameter to not throw an error and return the inputted text. Again, it's not a big deal, but imagine if everyone did it like this.

jcubic commented 8 months ago
  1. You can use figlet.textSync to return a string,

  2. error as the first callback argument is a convention from NodeJS.