A utility that converts standard Javascript numbers
into their spoken word string
based representations.
The system recursively iterates through a supplied number
and builds up corresponding string
that has accurate punctuation and formatting for direct integration into your application.
For example, 1036
would be converted into "One thousand and thirty six"
.
Creating friendlier and more intuitive user interfaces is increasingly critical in producing an inclusive application. Utilities like this are "delight" based enhancements that add extra polish to a given scenario.
Try out the CodePen demo or easily experiment inside your own application with the Installation and Usage instructions below.
Install the module from NPM .
npm install --save chocolate-cake
Import the module into your project.
import chocolateCake from "chocolate-cake";
Simply pass in a number
and get back the respective string
.
chocolateCake(1036); // One thousand and thirty six
In release v1.1.0
we have added support for negative values.
chocolateCake(-3210); // Negative three thousand, two hundred and ten
In release v1.1.0
we have added support for decimal values.
chocolateCake(12.34); // Twelve point three, four
This utility also supports Typescript
This utility can convert values up-to-the trillions increment.
chocolateCake(123456789012345); // One hundred and twenty three trillion, four hundred and fifty six billion, seven hundred and eighty nine million, twelve thousand, three hundred and forty five
MIT