Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (make-it-rain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
πΈ make-it-rain πΈ
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.
npm install make-it-rain
or if you're feeling edgy:
yarn add make-it-rain
π οΈ Usage
Initialize this life-changing formatter once, then flex on your ugly numbers forever.
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.