chocolate-cake
v1.1.2
Published
A utility that converts standard Javascript numbers into their spoken word string based representations
Downloads
9
Maintainers
Readme
Chocolate Cake 🍫 🎂 🍰 🍨 😋 😵
What 🤔
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"
.
Why 🤓
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.
Demo 😎
Try out the CodePen demo or easily experiment inside your own application with the Installation and Usage instructions below.
Installation 🤖
Install the module from NPM .
npm install --save chocolate-cake
Import the module into your project.
import chocolateCake from "chocolate-cake";
Usage 💾
Simply pass in a number
and get back the respective string
.
chocolateCake(1036); // One thousand and thirty six
Negative Values 🎊
In release v1.1.0
we have added support for negative values.
chocolateCake(-3210); // Negative three thousand, two hundred and ten
Decimal Values 🎉
In release v1.1.0
we have added support for decimal values.
chocolateCake(12.34); // Twelve point three, four
Typescript 👍
This utility also supports Typescript
Limitations 🎛 🎚
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
License 📜
MIT