finprim 0.1.1 → 0.1.3

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 CHANGED
@@ -1,50 +1,89 @@
1
- # finprim
1
+ <p align="center">
2
+ <h1 align="center">finprim</h1>
3
+ <p align="center">Financial primitives for modern TypeScript applications.</p>
4
+ </p>
5
+
6
+ <p align="center">
7
+ <a href="https://www.npmjs.com/package/finprim"><img src="https://img.shields.io/npm/v/finprim.svg" alt="npm version"></a>
8
+ <a href="https://www.npmjs.com/package/finprim"><img src="https://img.shields.io/npm/dm/finprim.svg" alt="npm downloads"></a>
9
+ <a href="https://github.com/tintolee/finprim/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/finprim.svg" alt="license"></a>
10
+ <a href="https://github.com/tintolee/finprim"><img src="https://img.shields.io/github/stars/tintolee/finprim?style=social" alt="GitHub stars"></a>
11
+ <img src="https://img.shields.io/badge/dependencies-0-brightgreen" alt="zero dependencies">
12
+ <img src="https://img.shields.io/badge/TypeScript-strict-blue" alt="TypeScript strict">
13
+ </p>
14
+
15
+ <p align="center">
16
+ <b>IBAN &middot; BIC/SWIFT &middot; Card &middot; Sort Code &middot; VAT &middot; Routing Number &middot; Loan/EMI &middot; Currency</b><br/>
17
+ One library. Zero dependencies. Fully typed.
18
+ </p>
2
19
 
3
- **Financial primitives for modern TypeScript applications.**
20
+ ---
4
21
 
5
- A unified, production-grade TypeScript library for validating and formatting financial data. No more stitching together five different packages. No more custom glue code. Just clean, typed, fintech-first utilities that work anywhere TypeScript runs.
22
+ > Every fintech team builds this internally. Sort code validation here, an IBAN check there, a custom currency formatter somewhere else. It's fragmented, inconsistent, and expensive to maintain. **finprim is the open source version of what your team has already written three times.**
6
23
 
7
24
  ---
8
25
 
9
- ## Why finprim?
26
+ ## Quick Start
10
27
 
11
- Every fintech team builds this internally. Sort code validation here, an IBAN check there, a custom currency formatter somewhere else. It's fragmented, inconsistent, and expensive to maintain.
28
+ ```bash
29
+ npm install finprim
30
+ ```
12
31
 
13
- finprim is the open source version of what your team has already written three times.
32
+ ```ts
33
+ import { validateIBAN, validateCardNumber, formatCurrency } from 'finprim'
34
+
35
+ const iban = validateIBAN('GB29NWBK60161331926819')
36
+ // { valid: true, value: 'GB29NWBK60161331926819', formatted: 'GB29 NWBK 6016 1331 9268 19', countryCode: 'GB' }
37
+
38
+ const card = validateCardNumber('4532015112830366')
39
+ // { valid: true, formatted: '4532 0151 1283 0366', network: 'Visa', last4: '0366' }
40
+
41
+ formatCurrency(1000.5, 'GBP', 'en-GB')
42
+ // '£1,000.50'
43
+ ```
44
+
45
+ **That's it.** No config. No setup. Just import and use.
14
46
 
15
47
  ---
16
48
 
17
- ## Features
49
+ ## Why finprim?
18
50
 
19
- - IBAN validation and formatting (80+ countries, with country code)
20
- - ✅ UK sort code and account number validation
21
- - BIC/SWIFT validation
22
- - Card number validation (Luhn, network detection, formatting)
23
- - Currency validation and formatting with locale support
24
- - Branded types for compile-time correctness
25
- - Zod schemas out of the box
26
- - ✅ Optional React hooks for form inputs
27
- - ✅ Zero dependencies at the core
28
- - ✅ Tree-shakeable ESM and CJS builds
29
- - ✅ Fully typed
51
+ | Problem | finprim |
52
+ |---|---|
53
+ | 5 different npm packages for financial validation | **One unified library** |
54
+ | Custom glue code between validators | **Consistent API across all validators** |
55
+ | Runtime type confusion | **Branded TypeScript types** for compile-time safety |
56
+ | No framework integration | **Built-in Zod schemas, React hooks, NestJS pipes** |
57
+ | Heavy dependency trees | **Zero runtime dependencies** |
30
58
 
31
59
  ---
32
60
 
33
- ## Installation
61
+ ## Features
34
62
 
35
- ```bash
36
- npm install finprim
37
- ```
63
+ - **Validators** - IBAN (80+ countries), BIC/SWIFT, UK sort code & account number, card number (Luhn + network detection), EU VAT, US ABA routing number
64
+ - **Loan math** - EMI calculation and full amortization schedules
65
+ - **Formatting** - Display-ready IBAN, sort code, account number, and multi-locale currency formatting
66
+ - **Branded types** - Compile-time correctness that prevents invalid data from flowing through your system
67
+ - **Framework integrations** - Zod schemas, React hooks, NestJS pipes (all optional)
68
+ - **Production-ready** - Input length guards, type checking, no sensitive data logging
69
+ - **Lightweight** - Zero dependencies, tree-shakeable ESM + CJS
38
70
 
39
- For Zod integration:
71
+ ---
40
72
 
41
- ```bash
42
- npm install finprim zod
43
- ```
73
+ ## Integrations
74
+
75
+ finprim works standalone or plugs into your existing stack:
76
+
77
+ | Import path | What it contains | Extra dependency |
78
+ |---|---|---|
79
+ | `finprim` | Core validators, formatters, loan math | none |
80
+ | `finprim/zod` | Zod schemas for validation pipelines | `zod` |
81
+ | `finprim/react` | React hooks for form inputs | `react` |
82
+ | `finprim/nest` | NestJS validation pipes | `@nestjs/common` |
44
83
 
45
84
  ---
46
85
 
47
- ## Usage
86
+ ## Usage Examples
48
87
 
49
88
  ### Validation
50
89
 
@@ -56,51 +95,76 @@ import {
56
95
  validateBIC,
57
96
  validateCardNumber,
58
97
  validateCurrencyCode,
98
+ validateEUVAT,
99
+ validateUSRoutingNumber,
59
100
  } from 'finprim'
60
101
 
61
- const iban = validateIBAN('GB29NWBK60161331926819')
102
+ validateIBAN('GB29NWBK60161331926819')
62
103
  // { valid: true, value: 'GB29NWBK60161331926819', formatted: 'GB29 NWBK 6016 1331 9268 19', countryCode: 'GB' }
63
104
 
64
- const sortCode = validateUKSortCode('60-16-13')
105
+ validateUKSortCode('60-16-13')
65
106
  // { valid: true, value: '601613', formatted: '60-16-13' }
66
107
 
67
- const account = validateUKAccountNumber('31926819')
108
+ validateUKAccountNumber('31926819')
68
109
  // { valid: true, value: '31926819', formatted: '3192 6819' }
69
110
 
70
- const card = validateCardNumber('4532015112830366')
71
- // { valid: true, value: '...', formatted: '4532 0151 1283 0366', network: 'Visa', last4: '0366' }
111
+ validateCardNumber('4532015112830366')
112
+ // { valid: true, formatted: '4532 0151 1283 0366', network: 'Visa', last4: '0366' }
113
+
114
+ validateEUVAT('DE123456789')
115
+ // { valid: true, value: 'DE123456789', formatted: 'DE 123456789', countryCode: 'DE' }
116
+
117
+ validateUSRoutingNumber('021000021')
118
+ // { valid: true, value: '021000021', formatted: '021000021' }
119
+ ```
120
+
121
+ ### Formatting & Display
122
+
123
+ ```ts
124
+ import { formatIBAN, formatSortCode, formatUKAccountNumber, formatCurrency, parseMoney } from 'finprim'
125
+
126
+ formatIBAN('GB29NWBK60161331926819') // 'GB29 NWBK 6016 1331 9268 19'
127
+ formatSortCode('601613') // '60-16-13'
128
+ formatUKAccountNumber('31926819') // '3192 6819'
129
+
130
+ formatCurrency(1000.5, 'GBP', 'en-GB') // '£1,000.50'
131
+ formatCurrency(1000.5, 'EUR', 'de-DE') // '1.000,50 €'
132
+ formatCurrency(1000.5, 'USD', 'en-US') // '$1,000.50'
133
+
134
+ parseMoney('£1,000.50')
135
+ // { valid: true, amount: 1000.50, currency: 'GBP', formatted: '£1,000.50' }
72
136
  ```
73
137
 
74
- ### Currency Formatting
138
+ ### Loan / EMI Calculation
75
139
 
76
140
  ```ts
77
- import { formatCurrency, parseMoney } from 'finprim'
141
+ import { calculateEMI, getLoanSchedule } from 'finprim'
78
142
 
79
- formatCurrency(1000.5, 'GBP', 'en-GB') // '£1,000.50'
80
- formatCurrency(1000.5, 'EUR', 'de-DE') // '1.000,50 €'
81
- formatCurrency(1000.5, 'USD', 'en-US') // '$1,000.50'
143
+ calculateEMI(100_000, 10, 12)
144
+ // Monthly payment amount
82
145
 
83
- parseMoney('£1,000.50') // { valid: true, amount: 1000.50, currency: 'GBP', formatted: '£1,000.50' }
146
+ getLoanSchedule(100_000, 10, 12)
147
+ // [{ month, payment, principal, interest, balance }, ...]
84
148
  ```
85
149
 
86
150
  ### Branded Types
87
151
 
88
152
  ```ts
89
- import type { IBAN, SortCode, AccountNumber, CurrencyCode } from 'finprim'
153
+ import type { IBAN, SortCode, AccountNumber } from 'finprim'
90
154
 
91
155
  // Invalid data cannot be passed where valid data is expected
92
- function processPayment(iban: IBAN, amount: number) { ... }
156
+ function processPayment(iban: IBAN, amount: number) { /* ... */ }
93
157
 
94
- // This forces validation before use
95
- const iban = validateIBAN(input)
96
- if (iban.valid) {
97
- processPayment(iban.value, 100) // iban.value is typed as IBAN
158
+ const result = validateIBAN(input)
159
+ if (result.valid) {
160
+ processPayment(result.value, 100) // result.value is typed as IBAN
98
161
  }
99
162
  ```
100
163
 
101
164
  ### Zod Schemas
102
165
 
103
166
  ```ts
167
+ import { z } from 'zod'
104
168
  import { ibanSchema, sortCodeSchema, accountNumberSchema, currencySchema } from 'finprim/zod'
105
169
 
106
170
  const PaymentSchema = z.object({
@@ -114,24 +178,39 @@ const PaymentSchema = z.object({
114
178
 
115
179
  ### React Hooks
116
180
 
117
- ```ts
181
+ ```tsx
118
182
  import { useIBANInput, useCardNumberInput, useCurrencyInput } from 'finprim/react'
119
183
 
120
184
  function PaymentForm() {
121
185
  const iban = useIBANInput()
122
186
  const card = useCardNumberInput()
123
- const { rawValue, formatted, onChange } = useCurrencyInput('GBP', 'en-GB')
187
+ const currency = useCurrencyInput('GBP', 'en-GB')
124
188
 
125
189
  return (
126
- <>
190
+ <form>
127
191
  <input value={iban.value} onChange={iban.onChange} aria-invalid={iban.valid === false} />
128
192
  <input value={card.formatted} onChange={card.onChange} aria-invalid={card.valid === false} />
129
- <input value={formatted} onChange={onChange} />
130
- </>
193
+ <input value={currency.formatted} onChange={currency.onChange} />
194
+ </form>
131
195
  )
132
196
  }
133
197
  ```
134
198
 
199
+ ### NestJS Pipes
200
+
201
+ ```ts
202
+ import { IbanValidationPipe, SortCodeValidationPipe, createValidationPipe } from 'finprim/nest'
203
+ import { validateIBAN } from 'finprim'
204
+
205
+ @Get('iban/:iban')
206
+ findByIban(@Param('iban', IbanValidationPipe) iban: string) {
207
+ return this.service.findByIban(iban)
208
+ }
209
+
210
+ // Create a custom pipe from any validator
211
+ const MyPipe = createValidationPipe(validateIBAN)
212
+ ```
213
+
135
214
  ---
136
215
 
137
216
  ## API Reference
@@ -140,64 +219,73 @@ function PaymentForm() {
140
219
 
141
220
  | Function | Input | Returns |
142
221
  |----------|-------|---------|
143
- | `validateIBAN(input)` | `string` | `IBANValidationResult` (includes `countryCode` when valid) |
222
+ | `validateIBAN(input)` | `string` | `IBANValidationResult` (includes `countryCode`) |
144
223
  | `validateUKSortCode(input)` | `string` | `ValidationResult<SortCode>` |
145
224
  | `validateUKAccountNumber(input)` | `string` | `ValidationResult<AccountNumber>` |
146
225
  | `validateCurrencyCode(input)` | `string` | `ValidationResult<CurrencyCode>` |
147
226
  | `validateBIC(input)` | `string` | `ValidationResult<BIC>` |
148
- | `validateCardNumber(input)` | `string` | `CardValidationResult` (includes `network`, `last4` when valid) |
227
+ | `validateCardNumber(input)` | `string` | `CardValidationResult` (includes `network`, `last4`) |
228
+ | `validateEUVAT(input)` | `string` | `VATValidationResult` (includes `countryCode`) |
229
+ | `validateUSRoutingNumber(input)` | `string` | `ValidationResult<RoutingNumber>` |
149
230
 
150
231
  ### Formatting
151
232
 
152
233
  | Function | Input | Returns |
153
234
  |----------|-------|---------|
235
+ | `formatIBAN(input)` | `string` | `string` (space-separated) |
236
+ | `formatSortCode(input)` | `string` | `string` (XX-XX-XX) |
237
+ | `formatUKAccountNumber(input)` | `string` | `string` (XXXX XXXX) |
154
238
  | `formatCurrency(amount, currency, locale?)` | `number`, `SupportedCurrency`, `string?` | `string` |
155
239
  | `parseMoney(input)` | `string` | `MoneyResult` |
156
240
 
157
- Validation results include a `formatted` string when valid (e.g. IBAN and card numbers are space-separated).
241
+ ### Loan
158
242
 
159
- ---
160
-
161
- ## Packages
162
-
163
- | Import path | What it contains | Extra dependency |
164
- |---|---|---|
165
- | `finprim` | Core validators and formatters | none |
166
- | `finprim/zod` | Zod schemas | `zod` |
167
- | `finprim/react` | React hooks | `react` |
243
+ | Function | Input | Returns |
244
+ |----------|-------|---------|
245
+ | `calculateEMI(principal, rate, months)` | `number`, `number`, `number` | `number` |
246
+ | `getLoanSchedule(principal, rate, months)` | `number`, `number`, `number` | `LoanScheduleEntry[]` |
168
247
 
169
248
  ---
170
249
 
171
- ## Tech Stack
250
+ ## Roadmap
172
251
 
173
- - TypeScript
174
- - tsup (build)
175
- - Vitest (testing)
176
- - React (optional hooks subpath)
177
- - Zod (optional schema subpath)
252
+ - [x] IBAN validation (80+ countries)
253
+ - [x] BIC/SWIFT validation
254
+ - [x] Card number validation (Luhn + network detection)
255
+ - [x] EU VAT number validation
256
+ - [x] US routing number validation
257
+ - [x] UK sort code and account number validation
258
+ - [x] Loan/EMI calculation
259
+ - [x] Format-only helpers
260
+ - [x] Currency formatting with locale support
261
+ - [x] Branded TypeScript types
262
+ - [x] Zod schema integration
263
+ - [x] React hooks
264
+ - [x] NestJS pipes
265
+ - [ ] More locale coverage
266
+ - [ ] SEPA credit transfer XML generation
267
+ - [ ] ACH file format support
178
268
 
179
269
  ---
180
270
 
181
- ## Roadmap
271
+ ## Security
182
272
 
183
- - [x] SWIFT / BIC validation
184
- - [x] Luhn algorithm for card number validation
185
- - [ ] EU VAT number validation
186
- - [ ] NestJS pipe integration
187
- - [ ] More locale coverage
273
+ - **Input length** - All string validators reject input longer than 256 characters
274
+ - **Type checking** - Validators require non-empty strings; numeric helpers require finite numbers and sane bounds
275
+ - **No sensitive logging** - The library does not log or persist input
276
+ - **Format helpers** - Cap input length and accept only strings
188
277
 
189
278
  ---
190
279
 
191
280
  ## Contributing
192
281
 
193
- Contributions are welcome. Please open an issue before submitting a pull request so we can discuss the change.
282
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
194
283
 
195
284
  ```bash
196
- git clone https://github.com/YOUR_USERNAME/finprim
285
+ git clone https://github.com/tintolee/finprim.git
197
286
  cd finprim
198
287
  npm install
199
288
  npm test
200
- npm run dev
201
289
  ```
202
290
 
203
291
  ---
@@ -8,6 +8,8 @@ type AccountNumber = Brand<string, 'AccountNumber'>;
8
8
  type CurrencyCode = Brand<string, 'CurrencyCode'>;
9
9
  type BIC = Brand<string, 'BIC'>;
10
10
  type CardNumber = Brand<string, 'CardNumber'>;
11
+ type VATNumber = Brand<string, 'VATNumber'>;
12
+ type RoutingNumber = Brand<string, 'RoutingNumber'>;
11
13
  type SupportedCurrency = 'GBP' | 'EUR' | 'USD' | 'JPY' | 'CHF' | 'CAD' | 'AUD' | 'NZD';
12
14
  type ValidationSuccess<T> = {
13
15
  valid: true;
@@ -20,6 +22,7 @@ type ValidationFailure = {
20
22
  };
21
23
  type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
22
24
  declare function isValidationSuccess<T>(result: ValidationResult<T>): result is ValidationSuccess<T>;
25
+ declare function isValidationFailure<T>(result: ValidationResult<T>): result is ValidationFailure;
23
26
  type IBANValidationSuccess = ValidationSuccess<IBAN> & {
24
27
  countryCode: string;
25
28
  };
@@ -33,6 +36,10 @@ type MoneyResult = {
33
36
  valid: false;
34
37
  error: string;
35
38
  };
39
+ type VATValidationSuccess = ValidationSuccess<VATNumber> & {
40
+ countryCode: string;
41
+ };
42
+ type VATValidationResult = VATValidationSuccess | ValidationFailure;
36
43
 
37
44
  type CardNetwork = 'Visa' | 'Mastercard' | 'Amex' | 'Discover' | 'Unknown';
38
45
  type CardValidationResult = {
@@ -47,4 +54,4 @@ type CardValidationResult = {
47
54
  };
48
55
  declare function validateCardNumber(input: string): CardValidationResult;
49
56
 
50
- export { type AccountNumber as A, type BIC as B, type CurrencyCode as C, type IBANValidationResult as I, type MoneyResult as M, type SortCode as S, type ValidationResult as V, type SupportedCurrency as a, type CardNetwork as b, type CardNumber as c, type CardValidationResult as d, type IBAN as e, type IBANValidationSuccess as f, type ValidationFailure as g, type ValidationSuccess as h, isValidationSuccess as i, validateCardNumber as v };
57
+ export { type AccountNumber as A, type BIC as B, type CurrencyCode as C, type IBANValidationResult as I, type MoneyResult as M, type RoutingNumber as R, type SortCode as S, type ValidationResult as V, type SupportedCurrency as a, type VATValidationResult as b, type CardNetwork as c, type CardNumber as d, type CardValidationResult as e, type IBAN as f, type IBANValidationSuccess as g, type VATNumber as h, type VATValidationSuccess as i, type ValidationFailure as j, type ValidationSuccess as k, isValidationFailure as l, isValidationSuccess as m, validateCardNumber as v };
@@ -8,6 +8,8 @@ type AccountNumber = Brand<string, 'AccountNumber'>;
8
8
  type CurrencyCode = Brand<string, 'CurrencyCode'>;
9
9
  type BIC = Brand<string, 'BIC'>;
10
10
  type CardNumber = Brand<string, 'CardNumber'>;
11
+ type VATNumber = Brand<string, 'VATNumber'>;
12
+ type RoutingNumber = Brand<string, 'RoutingNumber'>;
11
13
  type SupportedCurrency = 'GBP' | 'EUR' | 'USD' | 'JPY' | 'CHF' | 'CAD' | 'AUD' | 'NZD';
12
14
  type ValidationSuccess<T> = {
13
15
  valid: true;
@@ -20,6 +22,7 @@ type ValidationFailure = {
20
22
  };
21
23
  type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
22
24
  declare function isValidationSuccess<T>(result: ValidationResult<T>): result is ValidationSuccess<T>;
25
+ declare function isValidationFailure<T>(result: ValidationResult<T>): result is ValidationFailure;
23
26
  type IBANValidationSuccess = ValidationSuccess<IBAN> & {
24
27
  countryCode: string;
25
28
  };
@@ -33,6 +36,10 @@ type MoneyResult = {
33
36
  valid: false;
34
37
  error: string;
35
38
  };
39
+ type VATValidationSuccess = ValidationSuccess<VATNumber> & {
40
+ countryCode: string;
41
+ };
42
+ type VATValidationResult = VATValidationSuccess | ValidationFailure;
36
43
 
37
44
  type CardNetwork = 'Visa' | 'Mastercard' | 'Amex' | 'Discover' | 'Unknown';
38
45
  type CardValidationResult = {
@@ -47,4 +54,4 @@ type CardValidationResult = {
47
54
  };
48
55
  declare function validateCardNumber(input: string): CardValidationResult;
49
56
 
50
- export { type AccountNumber as A, type BIC as B, type CurrencyCode as C, type IBANValidationResult as I, type MoneyResult as M, type SortCode as S, type ValidationResult as V, type SupportedCurrency as a, type CardNetwork as b, type CardNumber as c, type CardValidationResult as d, type IBAN as e, type IBANValidationSuccess as f, type ValidationFailure as g, type ValidationSuccess as h, isValidationSuccess as i, validateCardNumber as v };
57
+ export { type AccountNumber as A, type BIC as B, type CurrencyCode as C, type IBANValidationResult as I, type MoneyResult as M, type RoutingNumber as R, type SortCode as S, type ValidationResult as V, type SupportedCurrency as a, type VATValidationResult as b, type CardNetwork as c, type CardNumber as d, type CardValidationResult as e, type IBAN as f, type IBANValidationSuccess as g, type VATNumber as h, type VATValidationSuccess as i, type ValidationFailure as j, type ValidationSuccess as k, isValidationFailure as l, isValidationSuccess as m, validateCardNumber as v };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,11 @@
1
- import { I as IBANValidationResult, V as ValidationResult, A as AccountNumber, S as SortCode, a as SupportedCurrency, M as MoneyResult, C as CurrencyCode, B as BIC } from './card-D3WC2rzV.mjs';
2
- export { b as CardNetwork, c as CardNumber, d as CardValidationResult, e as IBAN, f as IBANValidationSuccess, g as ValidationFailure, h as ValidationSuccess, i as isValidationSuccess, v as validateCardNumber } from './card-D3WC2rzV.mjs';
1
+ import { I as IBANValidationResult, V as ValidationResult, A as AccountNumber, S as SortCode, a as SupportedCurrency, M as MoneyResult, C as CurrencyCode, B as BIC, b as VATValidationResult, R as RoutingNumber } from './card-D2-7wbam.mjs';
2
+ export { c as CardNetwork, d as CardNumber, e as CardValidationResult, f as IBAN, g as IBANValidationSuccess, h as VATNumber, i as VATValidationSuccess, j as ValidationFailure, k as ValidationSuccess, l as isValidationFailure, m as isValidationSuccess, v as validateCardNumber } from './card-D2-7wbam.mjs';
3
3
 
4
+ declare function formatIBAN(input: string): string;
4
5
  declare function validateIBAN(input: string): IBANValidationResult;
5
6
 
7
+ declare function formatSortCode(input: string): string;
8
+ declare function formatUKAccountNumber(input: string): string;
6
9
  declare function validateUKSortCode(input: string): ValidationResult<SortCode>;
7
10
  declare function validateUKAccountNumber(input: string): ValidationResult<AccountNumber>;
8
11
 
@@ -13,4 +16,18 @@ declare function parseMoney(input: string): MoneyResult;
13
16
 
14
17
  declare function validateBIC(input: string): ValidationResult<BIC>;
15
18
 
16
- export { AccountNumber, BIC, CurrencyCode, IBANValidationResult, MoneyResult, SUPPORTED_CURRENCIES, SortCode, SupportedCurrency, ValidationResult, formatCurrency, parseMoney, validateBIC, validateCurrencyCode, validateIBAN, validateUKAccountNumber, validateUKSortCode };
19
+ declare function validateEUVAT(input: string): VATValidationResult;
20
+
21
+ declare function validateUSRoutingNumber(input: string): ValidationResult<RoutingNumber>;
22
+
23
+ type LoanScheduleEntry = {
24
+ month: number;
25
+ payment: number;
26
+ principal: number;
27
+ interest: number;
28
+ balance: number;
29
+ };
30
+ declare function calculateEMI(principal: number, annualRatePercent: number, months: number): number;
31
+ declare function getLoanSchedule(principal: number, annualRatePercent: number, months: number): LoanScheduleEntry[];
32
+
33
+ export { AccountNumber, BIC, CurrencyCode, IBANValidationResult, type LoanScheduleEntry, MoneyResult, RoutingNumber, SUPPORTED_CURRENCIES, SortCode, SupportedCurrency, VATValidationResult, ValidationResult, calculateEMI, formatCurrency, formatIBAN, formatSortCode, formatUKAccountNumber, getLoanSchedule, parseMoney, validateBIC, validateCurrencyCode, validateEUVAT, validateIBAN, validateUKAccountNumber, validateUKSortCode, validateUSRoutingNumber };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import { I as IBANValidationResult, V as ValidationResult, A as AccountNumber, S as SortCode, a as SupportedCurrency, M as MoneyResult, C as CurrencyCode, B as BIC } from './card-D3WC2rzV.js';
2
- export { b as CardNetwork, c as CardNumber, d as CardValidationResult, e as IBAN, f as IBANValidationSuccess, g as ValidationFailure, h as ValidationSuccess, i as isValidationSuccess, v as validateCardNumber } from './card-D3WC2rzV.js';
1
+ import { I as IBANValidationResult, V as ValidationResult, A as AccountNumber, S as SortCode, a as SupportedCurrency, M as MoneyResult, C as CurrencyCode, B as BIC, b as VATValidationResult, R as RoutingNumber } from './card-D2-7wbam.js';
2
+ export { c as CardNetwork, d as CardNumber, e as CardValidationResult, f as IBAN, g as IBANValidationSuccess, h as VATNumber, i as VATValidationSuccess, j as ValidationFailure, k as ValidationSuccess, l as isValidationFailure, m as isValidationSuccess, v as validateCardNumber } from './card-D2-7wbam.js';
3
3
 
4
+ declare function formatIBAN(input: string): string;
4
5
  declare function validateIBAN(input: string): IBANValidationResult;
5
6
 
7
+ declare function formatSortCode(input: string): string;
8
+ declare function formatUKAccountNumber(input: string): string;
6
9
  declare function validateUKSortCode(input: string): ValidationResult<SortCode>;
7
10
  declare function validateUKAccountNumber(input: string): ValidationResult<AccountNumber>;
8
11
 
@@ -13,4 +16,18 @@ declare function parseMoney(input: string): MoneyResult;
13
16
 
14
17
  declare function validateBIC(input: string): ValidationResult<BIC>;
15
18
 
16
- export { AccountNumber, BIC, CurrencyCode, IBANValidationResult, MoneyResult, SUPPORTED_CURRENCIES, SortCode, SupportedCurrency, ValidationResult, formatCurrency, parseMoney, validateBIC, validateCurrencyCode, validateIBAN, validateUKAccountNumber, validateUKSortCode };
19
+ declare function validateEUVAT(input: string): VATValidationResult;
20
+
21
+ declare function validateUSRoutingNumber(input: string): ValidationResult<RoutingNumber>;
22
+
23
+ type LoanScheduleEntry = {
24
+ month: number;
25
+ payment: number;
26
+ principal: number;
27
+ interest: number;
28
+ balance: number;
29
+ };
30
+ declare function calculateEMI(principal: number, annualRatePercent: number, months: number): number;
31
+ declare function getLoanSchedule(principal: number, annualRatePercent: number, months: number): LoanScheduleEntry[];
32
+
33
+ export { AccountNumber, BIC, CurrencyCode, IBANValidationResult, type LoanScheduleEntry, MoneyResult, RoutingNumber, SUPPORTED_CURRENCIES, SortCode, SupportedCurrency, VATValidationResult, ValidationResult, calculateEMI, formatCurrency, formatIBAN, formatSortCode, formatUKAccountNumber, getLoanSchedule, parseMoney, validateBIC, validateCurrencyCode, validateEUVAT, validateIBAN, validateUKAccountNumber, validateUKSortCode, validateUSRoutingNumber };