@robinpath/money
v0.1.1
Published
> Currency formatting, safe arithmetic, conversion, tax, discount, and exchange rates
Keywords
Readme
@robinpath/money
Currency formatting, safe arithmetic, conversion, tax, discount, and exchange rates
Why use this module?
The money module lets you:
- Format number as currency
- Parse currency string to number
- Safe addition
- Safe subtraction
- Safe multiplication
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/moneyQuick Start
No credentials needed — start using it right away:
money.parse "$1,234.56"Available Functions
| Function | Description |
|----------|-------------|
| money.format | Format number as currency |
| money.parse | Parse currency string to number |
| money.add | Safe addition |
| money.subtract | Safe subtraction |
| money.multiply | Safe multiplication |
| money.divide | Safe division |
| money.round | Round to currency precision |
| money.convert | Convert between currencies |
| money.fetchRate | Fetch live exchange rate |
| money.split | Split amount evenly |
| money.percentage | Calculate percentage |
| money.discount | Apply discount |
| money.tax | Add tax |
| money.currencyInfo | Get currency info |
| money.listCurrencies | List all currency codes |
| money.isValidCode | Check if currency code is valid |
Examples
Parse currency string to number
money.parse "$1,234.56"Safe addition
money.add 0.1 0.2Safe subtraction
money.subtract 10.50 3.25Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/money";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
money.parse "$1,234.56"
`);Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
