monetra 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -160
- package/dist/currency/Currency.d.ts +27 -0
- package/dist/currency/index.d.ts +4 -0
- package/dist/currency/iso4217.d.ts +245 -0
- package/dist/currency/precision.d.ts +2 -0
- package/dist/currency/registry.d.ts +22 -0
- package/dist/errors/BaseError.d.ts +22 -0
- package/dist/errors/CurrencyMismatchError.d.ts +12 -0
- package/dist/errors/InsufficientFundsError.d.ts +4 -0
- package/dist/errors/InvalidArgumentError.d.ts +4 -0
- package/dist/errors/InvalidPrecisionError.d.ts +4 -0
- package/dist/errors/OverflowError.d.ts +4 -0
- package/dist/errors/RoundingRequiredError.d.ts +4 -0
- package/dist/errors/index.d.ts +7 -0
- package/dist/financial/compound.d.ts +20 -0
- package/dist/financial/depreciation.d.ts +30 -0
- package/dist/financial/index.d.ts +7 -0
- package/dist/financial/index.js +1323 -0
- package/dist/financial/index.js.map +1 -0
- package/dist/financial/index.mjs +1275 -0
- package/dist/financial/index.mjs.map +1 -0
- package/dist/financial/investment.d.ts +31 -0
- package/dist/financial/leverage.d.ts +66 -0
- package/dist/financial/loan.d.ts +67 -0
- package/dist/financial/rate.d.ts +169 -0
- package/dist/financial/simple.d.ts +60 -0
- package/dist/format/formatter.d.ts +42 -0
- package/dist/format/parser.d.ts +53 -0
- package/dist/index.d.ts +11 -1202
- package/dist/index.js +263 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +248 -41
- package/dist/index.mjs.map +1 -1
- package/dist/ledger/Ledger.d.ts +65 -0
- package/dist/ledger/index.d.ts +3 -0
- package/dist/ledger/index.js +1054 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/ledger/index.mjs +1029 -0
- package/dist/ledger/index.mjs.map +1 -0
- package/dist/ledger/types.d.ts +30 -0
- package/dist/ledger/verification.d.ts +36 -0
- package/dist/money/Converter.d.ts +26 -0
- package/dist/money/Money.d.ts +299 -0
- package/dist/money/MoneyBag.d.ts +46 -0
- package/dist/money/allocation.d.ts +13 -0
- package/dist/money/arithmetic.d.ts +32 -0
- package/dist/money/guards.d.ts +3 -0
- package/dist/money/index.d.ts +4 -0
- package/dist/rounding/index.d.ts +3 -0
- package/dist/rounding/strategies.d.ts +36 -0
- package/dist/tokens/defineToken.d.ts +30 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +100 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/index.mjs +69 -0
- package/dist/tokens/index.mjs.map +1 -0
- package/dist/tokens/types.d.ts +13 -0
- package/package.json +34 -14
- package/dist/index.d.mts +0 -1211
package/README.md
CHANGED
|
@@ -1,245 +1,262 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# Monetra
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
A comprehensive TypeScript framework for building financial applications with precision and confidence.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
[](https://github.com/zugobite/monetra/actions/workflows/ci.yml)
|
|
8
|
+
[](coverage/index.html)
|
|
9
|
+
[](reports/mutation/mutation.html)
|
|
10
|
+
[](tests/property-based.test.ts)
|
|
11
|
+
[]()
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-

|
|
9
|
-

|
|
10
|
-

|
|
11
|
-

|
|
13
|
+
### Package Information
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
[](https://www.npmjs.com/package/monetra)
|
|
16
|
+
[](https://www.npmjs.com/package/monetra)
|
|
17
|
+
[](LICENSE)
|
|
18
|
+
[](https://www.typescriptlang.org/)
|
|
19
|
+
[](https://github.com/zugobite/monetra)
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
// ❌ Regular JavaScript
|
|
17
|
-
0.1 + 0.2 === 0.3 // false! (0.30000000000000004)
|
|
21
|
+
---
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
Money.fromDecimal('0.10', 'USD').add('0.20').equals('0.30') // true
|
|
21
|
-
```
|
|
23
|
+
## Overview
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
Monetra is a **zero-dependency TypeScript framework** that provides everything you need to build financially accurate applications. From precise money handling to transaction ledgers, from loan calculations to currency conversion - Monetra offers a complete, integrated solution.
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
**Built for financial correctness:** By storing amounts in minor units (cents, satoshis, wei) as `BigInt`, Monetra eliminates floating-point precision errors that plague traditional approaches.
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
While other libraries rely on floating-point math or simple wrappers, Monetra provides a full stack architecture for the **lifecycle of value**: from safe storage and precise allocation to complex financial modeling and immutable audit logging.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
It bridges the gap between simple e-commerce math and complex ledger systems, offering a unified, type-safe environment for building:
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
- **Neobanks & Digital Wallets**
|
|
34
|
+
- **Billing & Invoicing Engines**
|
|
35
|
+
- **Loan & Mortgage Calculators**
|
|
36
|
+
- **Double-Entry Ledgers**
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|---------|-------------|
|
|
35
|
-
| 🔢 **Integer-Based** | All values stored in minor units (BigInt). No floats, ever. |
|
|
36
|
-
| 🎯 **Explicit Rounding** | 6 rounding modes. You choose when and how. |
|
|
37
|
-
| 🌍 **Multi-Currency** | ISO 4217 currencies + custom tokens + crypto (18 decimals) |
|
|
38
|
-
| 📊 **Financial Math** | Loan payments, NPV, IRR, amortization schedules |
|
|
39
|
-
| 📝 **Audit Ledger** | Tamper-evident transaction history with SHA-256 hashing |
|
|
40
|
-
| 🔄 **Currency Conversion** | Rate management with historical lookups |
|
|
41
|
-
| 💼 **Wallet/MoneyBag** | Multi-currency portfolio management |
|
|
42
|
-
| ⚡ **Zero Dependencies** | Nothing to audit, nothing to break |
|
|
43
|
-
| 🌐 **Runs Everywhere** | Node.js, browsers, serverless, edge functions |
|
|
38
|
+
### The Monetra Stack
|
|
44
39
|
|
|
45
|
-
|
|
40
|
+
Monetra is architected in three distinct layers to ensure separation of concerns while maintaining type safety across your entire financial domain.
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
- [Core Concepts](#core-concepts)
|
|
49
|
-
- [Usage Examples](#usage-examples)
|
|
50
|
-
- [What's New in v2.0](#whats-new-in-v20)
|
|
51
|
-
- [Documentation](#documentation)
|
|
52
|
-
- [Testing](#testing)
|
|
53
|
-
- [Contributing](#contributing)
|
|
54
|
-
- [Security](#security)
|
|
55
|
-
- [License](#license)
|
|
42
|
+
#### Layer 1: The Core (Precision & Safety)
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
- **`Money`**: Immutable, integer-based monetary value object using `BigInt` to prevent the [`0.1 + 0.2` problem](https://0.30000000000000004.com/).
|
|
45
|
+
- **`Currency`**: ISO 4217 compliance out of the box, with support for custom tokens (crypto/loyalty points).
|
|
46
|
+
- **`Allocation`**: GAAP-compliant splitting algorithms (Distribute value without losing cents).
|
|
58
47
|
|
|
59
|
-
|
|
48
|
+
#### Layer 2: The Logic (Business Intelligence)
|
|
60
49
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
yarn add monetra
|
|
65
|
-
# or
|
|
66
|
-
pnpm add monetra
|
|
67
|
-
```
|
|
50
|
+
- **`Financial`**: Standardized implementation of TVM (Time Value of Money) formulas like `PMT`, `NPV`, `IRR`, and `Loan Amortization`.
|
|
51
|
+
- **`Interest`**: Exact calculation of Compound vs. Simple interest with day-count conventions.
|
|
52
|
+
- **`Depreciation`**: Asset lifecycle management (Straight-line, Declining balance).
|
|
68
53
|
|
|
69
|
-
|
|
54
|
+
#### Layer 3: The Audit (Compliance & Verification)
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
- **`Ledger`**: Append-only, double-entry accounting system.
|
|
57
|
+
- **`Verification`**: Cryptographic hashing of transaction chains to detect data tampering.
|
|
58
|
+
- **`Enforcement`**: Strict rules for credit/debit operations to ensure books always balance.
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
const price = money("10.50", "USD"); // $10.50
|
|
76
|
-
const tax = price.percentage(10); // $1.05
|
|
60
|
+
---
|
|
77
61
|
|
|
78
|
-
|
|
79
|
-
const total = price.add(tax); // $11.55
|
|
80
|
-
const discounted = total.subtract("2.00"); // $9.55
|
|
62
|
+
## Installation
|
|
81
63
|
|
|
82
|
-
|
|
64
|
+
```bash
|
|
65
|
+
pnpm add monetra
|
|
83
66
|
```
|
|
84
67
|
|
|
85
|
-
|
|
68
|
+
**Requirements:** Node.js 18+ or modern browsers with BigInt support.
|
|
86
69
|
|
|
87
|
-
|
|
70
|
+
---
|
|
88
71
|
|
|
89
|
-
|
|
72
|
+
## Why Monetra?
|
|
90
73
|
|
|
91
|
-
-
|
|
92
|
-
- `¥100` is stored as `100n`.
|
|
74
|
+
Monetra is more than a money library - it's a complete financial framework designed to handle the full spectrum of monetary operations in modern applications.
|
|
93
75
|
|
|
94
|
-
###
|
|
76
|
+
### Framework Capabilities
|
|
95
77
|
|
|
96
|
-
Money
|
|
78
|
+
**Core Money Operations**
|
|
97
79
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
80
|
+
- Integer-based storage (BigInt) eliminates floating-point errors
|
|
81
|
+
- ISO 4217 currency support with automatic precision handling
|
|
82
|
+
- Custom token definitions for cryptocurrencies (up to 18 decimals)
|
|
83
|
+
- Explicit rounding strategies (6 modes: HALF_UP, HALF_DOWN, HALF_EVEN, FLOOR, CEIL, TRUNCATE)
|
|
84
|
+
- Immutable API-all operations return new instances
|
|
101
85
|
|
|
102
|
-
|
|
103
|
-
console.log(b.format()); // "$15.00"
|
|
104
|
-
```
|
|
86
|
+
**Financial Mathematics**
|
|
105
87
|
|
|
106
|
-
|
|
88
|
+
- Compound interest calculations with flexible compounding periods
|
|
89
|
+
- Loan amortization schedules and payment calculations
|
|
90
|
+
- Present/future value computations
|
|
91
|
+
- Net Present Value (NPV) and Internal Rate of Return (IRR)
|
|
92
|
+
- Depreciation methods (straight-line, declining balance)
|
|
93
|
+
- Bond yield calculations and leverage metrics
|
|
107
94
|
|
|
108
|
-
|
|
95
|
+
**Transaction Ledger System**
|
|
109
96
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
- Append-only transaction log with hash chain verification
|
|
98
|
+
- Double-entry bookkeeping support
|
|
99
|
+
- Auditable history with cryptographic integrity
|
|
100
|
+
- Account balance tracking and reconciliation
|
|
101
|
+
- Async transaction processing with event handling
|
|
115
102
|
|
|
116
|
-
|
|
103
|
+
**Currency Management**
|
|
117
104
|
|
|
118
|
-
|
|
105
|
+
- Multi-currency support with type-safe operations
|
|
106
|
+
- Currency conversion with rate management
|
|
107
|
+
- Historical exchange rate lookups
|
|
108
|
+
- MoneyBag for aggregating different currencies
|
|
109
|
+
- Mix-currency operation protection
|
|
119
110
|
|
|
120
|
-
|
|
111
|
+
**Developer Experience**
|
|
121
112
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
- Zero runtime dependencies - no supply chain risks
|
|
114
|
+
- Full TypeScript support with strict types
|
|
115
|
+
- Comprehensive error handling with custom error classes
|
|
116
|
+
- Extensive test coverage (>95%) and mutation testing
|
|
117
|
+
- Tree-shakeable modular exports
|
|
118
|
+
- Framework integrations (React, Vue, Node.js)
|
|
125
119
|
|
|
126
|
-
|
|
127
|
-
// part2: $33.33
|
|
128
|
-
// part3: $33.33
|
|
129
|
-
// Sum: $100.00
|
|
130
|
-
```
|
|
120
|
+
---
|
|
131
121
|
|
|
132
|
-
##
|
|
122
|
+
## Use Cases
|
|
133
123
|
|
|
134
|
-
|
|
124
|
+
Monetra is built for applications that require financial precision:
|
|
135
125
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
- **E-commerce platforms** - Shopping carts, pricing, tax calculations
|
|
127
|
+
- **Banking & FinTech** - Account management, transactions, interest calculations
|
|
128
|
+
- **Accounting software** - Ledgers, reconciliation, financial reporting
|
|
129
|
+
- **Cryptocurrency apps** - Wallet balances, token transfers, DeFi calculations
|
|
130
|
+
- **SaaS billing** - Subscription management, invoicing, revenue recognition
|
|
131
|
+
- **Investment platforms** - Portfolio tracking, return calculations, tax reporting
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
const clamped = price.clamp(minPrice, maxPrice);
|
|
133
|
+
---
|
|
143
134
|
|
|
144
|
-
|
|
145
|
-
const decimal = price.toDecimalString(); // "10.50"
|
|
135
|
+
## Quick Start: The Framework in Action
|
|
146
136
|
|
|
147
|
-
|
|
148
|
-
const json = JSON.stringify(money);
|
|
149
|
-
const restored = JSON.parse(json, Money.reviver);
|
|
150
|
-
```
|
|
137
|
+
### 1. The Core: Safe Money Handling
|
|
151
138
|
|
|
152
|
-
|
|
139
|
+
Stop worrying about floating-point errors.
|
|
153
140
|
|
|
154
141
|
```typescript
|
|
155
|
-
|
|
156
|
-
```
|
|
142
|
+
import { money, Money } from "monetra";
|
|
157
143
|
|
|
158
|
-
|
|
144
|
+
// Safe integer math
|
|
145
|
+
const price = money("19.99", "USD");
|
|
146
|
+
const tax = Money.fromMinor(199, "USD"); // 199 cents
|
|
147
|
+
const total = price.add(tax);
|
|
159
148
|
|
|
160
|
-
|
|
161
|
-
const negative = Money.fromDecimal('-100.00', 'USD');
|
|
162
|
-
negative.format({ accounting: true }); // "($100.00)"
|
|
149
|
+
console.log(total.format()); // "$21.98"
|
|
163
150
|
```
|
|
164
151
|
|
|
165
|
-
###
|
|
152
|
+
### 2. The Logic: Build a Loan Calculator
|
|
166
153
|
|
|
167
|
-
|
|
168
|
-
import { Rate } from 'monetra';
|
|
154
|
+
Implement complex financial products without external formulas.
|
|
169
155
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
```typescript
|
|
157
|
+
import { money, pmt, loan } from "monetra";
|
|
158
|
+
|
|
159
|
+
// Calculate monthly mortgage payment
|
|
160
|
+
const payment = pmt({
|
|
161
|
+
principal: money("250000", "USD"), // $250k Loan
|
|
162
|
+
annualRate: 0.055, // 5.5% APR
|
|
163
|
+
years: 30,
|
|
164
|
+
});
|
|
165
|
+
// result: "$1,419.47"
|
|
166
|
+
|
|
167
|
+
// Generate the full amortization schedule
|
|
168
|
+
const schedule = loan({
|
|
169
|
+
principal: money("250000", "USD"),
|
|
170
|
+
rate: 0.055,
|
|
171
|
+
periods: 360, // 30 years * 12 months
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
console.log(`Total Interest: ${schedule.totalInterest.format()}`);
|
|
173
175
|
```
|
|
174
176
|
|
|
175
|
-
###
|
|
177
|
+
### 3. The Audit: Immutable Ledger
|
|
178
|
+
|
|
179
|
+
Record the transaction and verify integrity.
|
|
176
180
|
|
|
177
181
|
```typescript
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
import { Ledger, money } from "monetra";
|
|
183
|
+
|
|
184
|
+
// Initialize a ledger for USD
|
|
185
|
+
const bankLedger = new Ledger("USD");
|
|
186
|
+
|
|
187
|
+
// Record a transaction
|
|
188
|
+
bankLedger.record({
|
|
189
|
+
description: "Mortgage Payment - Jan",
|
|
190
|
+
entries: [
|
|
191
|
+
{ account: "user_wallet", credit: money("1419.47", "USD") },
|
|
192
|
+
{ account: "bank_receivables", debit: money("1419.47", "USD") },
|
|
193
|
+
],
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Verify the cryptographic chain
|
|
197
|
+
const isClean = bankLedger.verify(); // true
|
|
181
198
|
```
|
|
182
199
|
|
|
183
|
-
|
|
200
|
+
---
|
|
184
201
|
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
usd.add(eur);
|
|
188
|
-
} catch (error) {
|
|
189
|
-
if (error.code === MonetraErrorCode.CURRENCY_MISMATCH) {
|
|
190
|
-
// Handle programmatically
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
202
|
+
## Documentation
|
|
194
203
|
|
|
195
|
-
|
|
204
|
+
Full documentation is available in the [docs](docs/index.md) directory:
|
|
196
205
|
|
|
197
|
-
|
|
198
|
-
// Async methods for browser environments
|
|
199
|
-
const entry = await ledger.recordAsync(money, metadata);
|
|
200
|
-
const isValid = await ledger.verifyAsync();
|
|
201
|
-
```
|
|
206
|
+
**Getting Started**
|
|
202
207
|
|
|
203
|
-
|
|
208
|
+
- [Core Concepts](docs/core-concepts.md)
|
|
209
|
+
- [Installation & Setup](docs/getting-started.md)
|
|
204
210
|
|
|
205
|
-
|
|
211
|
+
**The Framework API**
|
|
206
212
|
|
|
207
|
-
|
|
213
|
+
- [Layer 1: Money & Currency](docs/core/money.md)
|
|
214
|
+
- [Layer 2: Financial Math](docs/logic/financial.md)
|
|
215
|
+
- [Layer 3: Ledger & Audit](docs/audit/ledger.md)
|
|
208
216
|
|
|
209
|
-
|
|
210
|
-
1. [Core Concepts](docs/001-CORE-CONCEPTS.md) - Fundamental principles and design decisions
|
|
211
|
-
2. [Ledger System](docs/002-LEDGER-SYSTEM.md) - Audit trails and transaction history
|
|
212
|
-
3. [Financial Math](docs/003-FINANCIAL-MATH.md) - Loans, investments, and time-value-of-money
|
|
213
|
-
4. [Tokens & Crypto](docs/004-TOKENS-AND-CRYPTO.md) - Cryptocurrency and custom token support
|
|
214
|
-
5. [API Reference](docs/005-API-REFERENCE.md) - Complete API documentation
|
|
215
|
-
6. [Migration Guide v2.0](docs/006-MIGRATION-v2.md) - Upgrading from v1.x
|
|
216
|
-
7. [Cookbook](docs/007-COOKBOOK.md) - Practical recipes and patterns
|
|
217
|
+
**Guides & Best Practices**
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
- [Precise Allocation (Splitting)](docs/guides/allocation.md)
|
|
220
|
+
- [Handling Custom Tokens](docs/guides/custom-tokens.md)
|
|
221
|
+
- [Error Handling Strategies](docs/guides/error-handling.md)
|
|
222
|
+
- [Integration Examples (React, Vue, Node)](docs/examples/node.md)
|
|
219
223
|
|
|
220
|
-
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Testing & Support
|
|
221
227
|
|
|
222
228
|
```bash
|
|
223
|
-
# Run
|
|
224
|
-
|
|
229
|
+
# Run the test suite
|
|
230
|
+
pnpm test
|
|
231
|
+
|
|
232
|
+
# Run property-based verification
|
|
233
|
+
pnpm test:property
|
|
225
234
|
|
|
226
|
-
# Run
|
|
227
|
-
|
|
235
|
+
# Run coverage report
|
|
236
|
+
pnpm test:coverage
|
|
228
237
|
|
|
229
|
-
#
|
|
230
|
-
|
|
238
|
+
# Run mutation testing
|
|
239
|
+
pnpm test:mutation
|
|
231
240
|
```
|
|
232
241
|
|
|
242
|
+
---
|
|
243
|
+
|
|
233
244
|
## Contributing
|
|
234
245
|
|
|
235
|
-
|
|
246
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
247
|
+
|
|
248
|
+
Check our [Project Roadmap](https://github.com/users/zugobite/projects/2) to see what we're working on.
|
|
236
249
|
|
|
237
|
-
|
|
250
|
+
Please review our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.
|
|
251
|
+
|
|
252
|
+
---
|
|
238
253
|
|
|
239
254
|
## Security
|
|
240
255
|
|
|
241
|
-
|
|
256
|
+
Report security vulnerabilities according to our [Security Policy](SECURITY.md).
|
|
257
|
+
|
|
258
|
+
---
|
|
242
259
|
|
|
243
260
|
## License
|
|
244
261
|
|
|
245
|
-
|
|
262
|
+
MIT - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a currency with its metadata.
|
|
3
|
+
*
|
|
4
|
+
* This interface defines the structure for currency objects used throughout the library.
|
|
5
|
+
* It includes the ISO 4217 code, the number of decimal places (precision),
|
|
6
|
+
* the currency symbol, and an optional default locale for formatting.
|
|
7
|
+
*/
|
|
8
|
+
export interface Currency {
|
|
9
|
+
/**
|
|
10
|
+
* The ISO 4217 currency code (e.g., "USD", "EUR", "ZAR").
|
|
11
|
+
*/
|
|
12
|
+
code: string;
|
|
13
|
+
/**
|
|
14
|
+
* The number of decimal places for the currency.
|
|
15
|
+
* This defines the precision of the currency (e.g., 2 for USD, 0 for JPY).
|
|
16
|
+
*/
|
|
17
|
+
decimals: number;
|
|
18
|
+
/**
|
|
19
|
+
* The symbol associated with the currency (e.g., "$", "€", "R").
|
|
20
|
+
*/
|
|
21
|
+
symbol: string;
|
|
22
|
+
/**
|
|
23
|
+
* The default locale to use when formatting amounts in this currency (e.g., "en-US").
|
|
24
|
+
* If not provided, the formatter may fall back to a default or user-provided locale.
|
|
25
|
+
*/
|
|
26
|
+
locale?: string;
|
|
27
|
+
}
|