https://github.com/devonchurch/chocolate-cake
A utility that converts standard Javascript Numbers into their spoken word String based representations
https://github.com/devonchurch/chocolate-cake
helper library npm-package typescript-library utility
Last synced: about 1 year ago
JSON representation
A utility that converts standard Javascript Numbers into their spoken word String based representations
- Host: GitHub
- URL: https://github.com/devonchurch/chocolate-cake
- Owner: devonChurch
- License: mit
- Created: 2018-12-20T08:20:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T20:14:56.000Z (over 3 years ago)
- Last Synced: 2024-10-14T02:34:48.745Z (over 1 year ago)
- Topics: helper, library, npm-package, typescript-library, utility
- Language: TypeScript
- Homepage:
- Size: 1.03 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chocolate Cake 🍫 🎂 🍰 🍨 😋 😵
[](https://badge.fury.io/js/chocolate-cake)
[](https://www.typescriptlang.org/) [](https://prettier.io/) [](http://commitizen.github.io/cz-cli/)
## 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](https://codepen.io/DevonChurch/pen/wRemEe?editors=0010) or easily experiment inside your own application with the [Installation](https://github.com/devonChurch/chocolate-cake#installation-) and [Usage](https://github.com/devonChurch/chocolate-cake#usage-) instructions below.

## Installation 🤖
Install the module from **NPM** .
```
npm install --save chocolate-cake
```
Import the module into your project.
```javascript
import chocolateCake from "chocolate-cake";
```
## Usage 💾
Simply pass in a `number` and get back the respective `string`.
```javascript
chocolateCake(1036); // One thousand and thirty six
```
### Negative Values 🎊
In release `v1.1.0` we have added support for negative values.

```javascript
chocolateCake(-3210); // Negative three thousand, two hundred and ten
```
### Decimal Values 🎉
In release `v1.1.0` we have added support for decimal values.

```javascript
chocolateCake(12.34); // Twelve point three, four
```
### Typescript 👍
This utility also supports Typescript

### Limitations 🎛 🎚
This utility can convert values up-to-the _trillions_ increment.
```javascript
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