a simple lib for converting numbers to ASCII art text.
import font from 'ascii-numbers/fonts/ANSI_Shadow';
import ASCIINumbers from 'ascii-numbers';
const asciiNumbersWithFont = new ASCIINumbers(font);
console.log(asciiNumbersWithFont.getNumber(123))
/* Output
██╗ ██████╗ ██████╗
███║ ╚════██╗ ╚════██╗
╚██║ █████╔╝ █████╔╝
██║ ██╔═══╝ ╚═══██╗
██║ ███████╗ ██████╔╝
╚═╝ ╚══════╝ ╚═════╝
*/
You can pass second parameter with options to ASCIINumbers constructor.
const config = {
lineLength: 80,
minDigits: null,
space: ''
};
const asciiNumbersWithFont = new ASCIINumbers(font, config);
lineLength defines the maximum usable space for ascii text output. Default is 80 characters.
minDigits defines number alignment. If the printed number has fewer than 'minDigits' digits, then is prefixed by spaces.
...
const asciiNumbersWithFont = new ASCIINumbers(font, { minDigits: 6 });
console.log(asciiNumbersWithFont.getNumber(123))
/* Output
██╗ ██████╗ ██████╗
███║ ╚════██╗ ╚════██╗
╚██║ █████╔╝ █████╔╝
██║ ██╔═══╝ ╚═══██╗
██║ ███████╗ ██████╔╝
╚═╝ ╚══════╝ ╚═════╝
*/
space defines separator between digits.
...
const asciiNumbersWithFont = new ASCIINumbers(font, { space: '***' });
console.log(asciiNumbersWithFont.getNumber(123))
/* Output
██╗ *** ██████╗ *** ██████╗
███║ *** ╚════██╗*** ╚════██╗
╚██║ *** █████╔╝*** █████╔╝
██║ *** ██╔═══╝ *** ╚═══██╗
██║ *** ███████╗*** ██████╔╝
╚═╝ *** ╚══════╝*** ╚═════╝
*/
This lib use ANSI Shadow font from figlet, but you can simply create your own font. Check ANSI_Shadow.js for font structure.