make-it-rain
Version:
Because who formats money manually like a peasant?
73 lines (52 loc) โข 3.06 kB
Markdown
# ๐ธ make-it-rain ๐ธ
[](https://npmjs.com/package/make-it-rain) [](https://nodejs.org/) [](https://opensource.org/licenses/MIT)
### The Only Money Formatter You'll Ever Need (Probably)
So, you've finally decided that numbers should look nice? **Wow, groundbreaking.**
Instead of manually adding commas and dots like a caveman, let **`make-it-rain`** handle the **tough** job of making your numbers **actually readable**.
## ๐ Why Use This?
Because:
โ
You want your app to look like it knows what money is.
โ
You're too lazy to format numbers manually (same).
โ
You finally realized not everyone uses the same thousands separator.
โ
You enjoy writing `toLocaleString()` 50 times per project? No? Didnโt think so.
## ๐ฆ Installation
Oh no, another package to install? **Deal with it.**
```sh
npm install make-it-rain
```
or if you're feeling edgy:
```sh
yarn add make-it-rain
```
## ๐ ๏ธ Usage
Initialize this life-changing formatter once, then flex on your ugly numbers forever.
```js
const makeItRain = require("make-it-rain");
const money = makeItRain("EUR", ".", true); // Set it and forget it
console.log(money.makeItPretty(1234567.89)); // โฌ1.234.567,89
money.useWhat(false); // Switch to ISO code mode
console.log(money.makeItPretty(1234567.89)); // EUR 1.234.567,89
```
| Method | Description |
|--------|-------------|
|`makeItRain(currency, separator, useSymbol)` | Initializes the formatter once. Currency = any ISO currency code, separator = `,` or .`,` useSymbol = `true` for symbols (`$`), `false` for codes (`USD`). |
| `makeItPretty(amount)` | Takes a number and makes it visually acceptable.|
| `swapMoney(newCurrency)` | Change the currency to something else, because why not? |
| `useWhat(symbol)` | Toggle between using currency symbols (`$`) or ISO codes (`USD`). |
| `whatNow()` | Returns the current currency, in case you forgot. |
## ๐ฉ Features (That Should Have Existed in JavaScript Already)
- One-time setup: Set currency & separator once, use it everywhere.
- Formats numbers beautifully: Because nobody likes reading 1000000.00.
- Handles separators like a champ: Pick , or ., because the world can't agree.
- Errors when you mess up: Because I'm not letting you pass "lol" as a number.
## โ What This Wonโt Do
- Convert currency: This isn't a forex exchange, buddy.
- Fix your bad financial decisions: Your debt is still your problem.
- Magically make you rich: But hey, your numbers will look expensive.
## ๐ Contributing
Want to contribute? Cool. Fork it, break it, fix it, and submit a PR.
## ๐ License
MIT โ Because I'm not here to sue you.
## โญ Pro Tip
Use this package and pretend youโre rich. Youโre welcome.
This README will **ensure** your package is taken *seriously* while also making people question their life choices.