Format any number to -illion format!
Example:
bigint2text({
num: 123456789012345678901234567890123456789012345678901234567890n,
formatTriples: true,
});
produces:
'one hundred and twenty-three octodecillion four hundred and fifty-six septendecillion seven hundred and eighty-nine sexdecillion twelve quindecillion three hundred and fourty-five quattuordecillion six hundred and seventy tredecillion three hundred and fifty-six duodecillion three hundred and nineteen undecillion six hundred and six decillion four hundred and eighty-three nonillion nine hundred and eleven octillion two hundred and twenty-nine septillion six hundred and seventy-six sextillion one hundred and twenty-two quintillion four hundred and twenty-six quadrillion two hundred and two trillion five hundred and ninety-seven billion thirty-eight million seven hundred and fifty-one thousand seven hundred and fourty-four'
npm i bigint2text
or
yarn add bigint2text
To install:
npm i -g bigint2text
$ n2t --help
Usage: n2t -n [num] [-sf]
Options:
--help Show help [boolean]
--version Show version number [boolean]
-n, --num Number to be formatted [string]
-s, --short If passed, variant will be `'short'` instead of `'long'` [boolean] [default: false]
-f, --formatTriples If `true`, format each 3-digit. Default is `false` [boolean] [default: false]
With stdin:
$ n2t
Enter an integer number: 123456789
123 million 456 thousand 789
With pipe:
$ echo 123456789 | n2t
123 million 456 thousand 789
With args:
$ n2t -n 123456789
123 million 456 thousand 789
$ n2t -n 123456789 -s
123 m 456 k 789
$ n2t -n 123456789 -f
one hundred and twenty-three million four hundred and fifty-six thousand seven hundred and eighty-nine