@indodev/toolkit 0.2.0 → 0.3.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/dist/{compare-B1MKSOWV.d.cts → compare-BIodyGn7.d.cts} +54 -1
- package/dist/{compare-B1MKSOWV.d.ts → compare-BIodyGn7.d.ts} +54 -1
- package/dist/currency/index.cjs +23 -0
- package/dist/currency/index.cjs.map +1 -1
- package/dist/currency/index.d.cts +367 -3
- package/dist/currency/index.d.ts +367 -3
- package/dist/currency/index.js +21 -1
- package/dist/currency/index.js.map +1 -1
- package/dist/index.cjs +1117 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -4
- package/dist/index.d.ts +110 -4
- package/dist/index.js +1095 -1
- package/dist/index.js.map +1 -1
- package/dist/nik/index.cjs +44 -0
- package/dist/nik/index.cjs.map +1 -1
- package/dist/nik/index.d.cts +44 -1
- package/dist/nik/index.d.ts +44 -1
- package/dist/nik/index.js +41 -1
- package/dist/nik/index.js.map +1 -1
- package/dist/phone/index.cjs +42 -0
- package/dist/phone/index.cjs.map +1 -1
- package/dist/phone/index.d.cts +57 -1
- package/dist/phone/index.d.ts +57 -1
- package/dist/phone/index.js +39 -1
- package/dist/phone/index.js.map +1 -1
- package/dist/text/index.cjs +811 -0
- package/dist/text/index.cjs.map +1 -1
- package/dist/text/index.d.cts +1 -1
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.js +808 -1
- package/dist/text/index.js.map +1 -1
- package/package.json +38 -18
- package/LICENCE +0 -21
- package/dist/words-Dy8iYkbv.d.cts +0 -333
- package/dist/words-Dy8iYkbv.d.ts +0 -333
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Currency module types for Indonesian Rupiah utilities.
|
|
3
|
-
*
|
|
4
|
-
* @module currency/types
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Options for formatting Rupiah currency.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* Default formatting:
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const options: RupiahOptions = {
|
|
14
|
-
* symbol: true,
|
|
15
|
-
* decimal: false,
|
|
16
|
-
* separator: '.',
|
|
17
|
-
* };
|
|
18
|
-
* formatRupiah(1500000, options); // 'Rp 1.500.000'
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* With decimals:
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const options: RupiahOptions = {
|
|
25
|
-
* symbol: true,
|
|
26
|
-
* decimal: true,
|
|
27
|
-
* precision: 2,
|
|
28
|
-
* };
|
|
29
|
-
* formatRupiah(1500000.50, options); // 'Rp 1.500.000,50'
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
interface RupiahOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Whether to show 'Rp' symbol.
|
|
37
|
-
*
|
|
38
|
-
* @defaultValue true
|
|
39
|
-
*/
|
|
40
|
-
symbol?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Whether to show decimal places.
|
|
43
|
-
*
|
|
44
|
-
* @defaultValue false
|
|
45
|
-
*/
|
|
46
|
-
decimal?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Thousands separator character.
|
|
49
|
-
*
|
|
50
|
-
* @defaultValue '.'
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* '.' // Indonesian standard
|
|
55
|
-
* ',' // International standard
|
|
56
|
-
* ' ' // Space separator
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
separator?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Decimal separator character.
|
|
62
|
-
*
|
|
63
|
-
* @defaultValue ','
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* ',' // Indonesian standard
|
|
68
|
-
* '.' // International standard
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
decimalSeparator?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Number of decimal places to show.
|
|
74
|
-
*
|
|
75
|
-
* @defaultValue 0
|
|
76
|
-
*/
|
|
77
|
-
precision?: number;
|
|
78
|
-
/**
|
|
79
|
-
* Whether to add space after 'Rp' symbol.
|
|
80
|
-
*
|
|
81
|
-
* @defaultValue true
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* true // 'Rp 1.500.000'
|
|
86
|
-
* false // 'Rp1.500.000'
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
spaceAfterSymbol?: boolean;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Options for converting numbers to Indonesian words (terbilang).
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* Default:
|
|
96
|
-
* ```typescript
|
|
97
|
-
* toWords(1500000); // 'satu juta lima ratus ribu rupiah'
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* Uppercase:
|
|
102
|
-
* ```typescript
|
|
103
|
-
* toWords(1500000, { uppercase: true });
|
|
104
|
-
* // 'Satu juta lima ratus ribu rupiah'
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* Without currency suffix:
|
|
109
|
-
* ```typescript
|
|
110
|
-
* toWords(1500000, { withCurrency: false });
|
|
111
|
-
* // 'satu juta lima ratus ribu'
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
interface WordOptions {
|
|
117
|
-
/**
|
|
118
|
-
* Whether to capitalize the first letter.
|
|
119
|
-
*
|
|
120
|
-
* @defaultValue false
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* false // 'satu juta'
|
|
125
|
-
* true // 'Satu juta'
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
uppercase?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Whether to add 'rupiah' at the end.
|
|
131
|
-
*
|
|
132
|
-
* @defaultValue true
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* true // 'satu juta rupiah'
|
|
137
|
-
* false // 'satu juta'
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
withCurrency?: boolean;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Unit for rounding currency amounts.
|
|
144
|
-
*
|
|
145
|
-
* Common Indonesian currency rounding units:
|
|
146
|
-
* - `'ribu'`: Round to thousands (1.000)
|
|
147
|
-
* - `'ratus-ribu'`: Round to hundred thousands (100.000)
|
|
148
|
-
* - `'juta'`: Round to millions (1.000.000)
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* ```typescript
|
|
152
|
-
* roundToClean(1234567, 'ribu'); // 1235000
|
|
153
|
-
* roundToClean(1234567, 'ratus-ribu'); // 1200000
|
|
154
|
-
* roundToClean(1234567, 'juta'); // 1000000
|
|
155
|
-
* ```
|
|
156
|
-
*
|
|
157
|
-
* @public
|
|
158
|
-
*/
|
|
159
|
-
type RoundUnit = 'ribu' | 'ratus-ribu' | 'juta';
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Currency formatting utilities for Indonesian Rupiah.
|
|
163
|
-
*
|
|
164
|
-
* @module currency/format
|
|
165
|
-
* @packageDocumentation
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Formats a number as Indonesian Rupiah currency.
|
|
170
|
-
*
|
|
171
|
-
* Provides flexible formatting options including symbol display,
|
|
172
|
-
* decimal places, and custom separators.
|
|
173
|
-
*
|
|
174
|
-
* @param amount - The amount to format
|
|
175
|
-
* @param options - Formatting options
|
|
176
|
-
* @returns Formatted Rupiah string
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* Basic formatting:
|
|
180
|
-
* ```typescript
|
|
181
|
-
* formatRupiah(1500000); // 'Rp 1.500.000'
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* With decimals:
|
|
186
|
-
* ```typescript
|
|
187
|
-
* formatRupiah(1500000.50, { decimal: true }); // 'Rp 1.500.000,50'
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* Without symbol:
|
|
192
|
-
* ```typescript
|
|
193
|
-
* formatRupiah(1500000, { symbol: false }); // '1.500.000'
|
|
194
|
-
* ```
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* Custom separators:
|
|
198
|
-
* ```typescript
|
|
199
|
-
* formatRupiah(1500000, { separator: ',' }); // 'Rp 1,500,000'
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
|
-
declare function formatRupiah(amount: number, options?: RupiahOptions): string;
|
|
205
|
-
/**
|
|
206
|
-
* Formats a number in compact Indonesian format.
|
|
207
|
-
*
|
|
208
|
-
* Uses Indonesian units: ribu, juta, miliar, triliun.
|
|
209
|
-
* Follows Indonesian grammar rules (e.g., "1 juta" not "1,0 juta").
|
|
210
|
-
*
|
|
211
|
-
* @param amount - The amount to format
|
|
212
|
-
* @returns Compact formatted string
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* Millions:
|
|
216
|
-
* ```typescript
|
|
217
|
-
* formatCompact(1500000); // 'Rp 1,5 juta'
|
|
218
|
-
* formatCompact(1000000); // 'Rp 1 juta'
|
|
219
|
-
* ```
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* Thousands:
|
|
223
|
-
* ```typescript
|
|
224
|
-
* formatCompact(500000); // 'Rp 500 ribu'
|
|
225
|
-
* ```
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* Small numbers:
|
|
229
|
-
* ```typescript
|
|
230
|
-
* formatCompact(1500); // 'Rp 1.500'
|
|
231
|
-
* ```
|
|
232
|
-
*
|
|
233
|
-
* @public
|
|
234
|
-
*/
|
|
235
|
-
declare function formatCompact(amount: number): string;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Currency parsing utilities for Indonesian Rupiah.
|
|
239
|
-
*
|
|
240
|
-
* @module currency/parse
|
|
241
|
-
* @packageDocumentation
|
|
242
|
-
*/
|
|
243
|
-
/**
|
|
244
|
-
* Parses a formatted Rupiah string back to a number.
|
|
245
|
-
*
|
|
246
|
-
* Handles multiple formats:
|
|
247
|
-
* - Standard: "Rp 1.500.000"
|
|
248
|
-
* - No symbol: "1.500.000"
|
|
249
|
-
* - With decimals: "Rp 1.500.000,50"
|
|
250
|
-
* - Compact: "Rp 1,5 juta", "Rp 500 ribu"
|
|
251
|
-
*
|
|
252
|
-
* @param formatted - The formatted Rupiah string to parse
|
|
253
|
-
* @returns Parsed number, or null if invalid
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* Standard format:
|
|
257
|
-
* ```typescript
|
|
258
|
-
* parseRupiah('Rp 1.500.000'); // 1500000
|
|
259
|
-
* ```
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* With decimals:
|
|
263
|
-
* ```typescript
|
|
264
|
-
* parseRupiah('Rp 1.500.000,50'); // 1500000.50
|
|
265
|
-
* ```
|
|
266
|
-
*
|
|
267
|
-
* @example
|
|
268
|
-
* Compact format:
|
|
269
|
-
* ```typescript
|
|
270
|
-
* parseRupiah('Rp 1,5 juta'); // 1500000
|
|
271
|
-
* parseRupiah('Rp 500 ribu'); // 500000
|
|
272
|
-
* ```
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* Invalid input:
|
|
276
|
-
* ```typescript
|
|
277
|
-
* parseRupiah('invalid'); // null
|
|
278
|
-
* ```
|
|
279
|
-
*
|
|
280
|
-
* @public
|
|
281
|
-
*/
|
|
282
|
-
declare function parseRupiah(formatted: string): number | null;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Convert numbers to Indonesian words (terbilang).
|
|
286
|
-
*
|
|
287
|
-
* @module currency/words
|
|
288
|
-
* @packageDocumentation
|
|
289
|
-
*/
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Converts a number to Indonesian words (terbilang).
|
|
293
|
-
*
|
|
294
|
-
* Supports numbers up to trillions (triliun).
|
|
295
|
-
* Follows Indonesian language rules for number pronunciation.
|
|
296
|
-
*
|
|
297
|
-
* Special rules:
|
|
298
|
-
* - 1 = "satu" in most cases, but "se-" for 100, 1000
|
|
299
|
-
* - 11 = "sebelas" (not "satu belas")
|
|
300
|
-
* - 100 = "seratus" (not "satu ratus")
|
|
301
|
-
* - 1000 = "seribu" (not "satu ribu")
|
|
302
|
-
*
|
|
303
|
-
* @param amount - The number to convert
|
|
304
|
-
* @param options - Conversion options
|
|
305
|
-
* @returns Indonesian words representation
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* Basic numbers:
|
|
309
|
-
* ```typescript
|
|
310
|
-
* toWords(123); // 'seratus dua puluh tiga rupiah'
|
|
311
|
-
* ```
|
|
312
|
-
*
|
|
313
|
-
* @example
|
|
314
|
-
* Large numbers:
|
|
315
|
-
* ```typescript
|
|
316
|
-
* toWords(1500000); // 'satu juta lima ratus ribu rupiah'
|
|
317
|
-
* ```
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* With options:
|
|
321
|
-
* ```typescript
|
|
322
|
-
* toWords(1500000, { uppercase: true });
|
|
323
|
-
* // 'Satu juta lima ratus ribu rupiah'
|
|
324
|
-
*
|
|
325
|
-
* toWords(1500000, { withCurrency: false });
|
|
326
|
-
* // 'satu juta lima ratus ribu'
|
|
327
|
-
* ```
|
|
328
|
-
*
|
|
329
|
-
* @public
|
|
330
|
-
*/
|
|
331
|
-
declare function toWords(amount: number, options?: WordOptions): string;
|
|
332
|
-
|
|
333
|
-
export { type RupiahOptions as R, type WordOptions as W, formatCompact as a, type RoundUnit as b, formatRupiah as f, parseRupiah as p, toWords as t };
|
package/dist/words-Dy8iYkbv.d.ts
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Currency module types for Indonesian Rupiah utilities.
|
|
3
|
-
*
|
|
4
|
-
* @module currency/types
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Options for formatting Rupiah currency.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* Default formatting:
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const options: RupiahOptions = {
|
|
14
|
-
* symbol: true,
|
|
15
|
-
* decimal: false,
|
|
16
|
-
* separator: '.',
|
|
17
|
-
* };
|
|
18
|
-
* formatRupiah(1500000, options); // 'Rp 1.500.000'
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* With decimals:
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const options: RupiahOptions = {
|
|
25
|
-
* symbol: true,
|
|
26
|
-
* decimal: true,
|
|
27
|
-
* precision: 2,
|
|
28
|
-
* };
|
|
29
|
-
* formatRupiah(1500000.50, options); // 'Rp 1.500.000,50'
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
interface RupiahOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Whether to show 'Rp' symbol.
|
|
37
|
-
*
|
|
38
|
-
* @defaultValue true
|
|
39
|
-
*/
|
|
40
|
-
symbol?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Whether to show decimal places.
|
|
43
|
-
*
|
|
44
|
-
* @defaultValue false
|
|
45
|
-
*/
|
|
46
|
-
decimal?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Thousands separator character.
|
|
49
|
-
*
|
|
50
|
-
* @defaultValue '.'
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* '.' // Indonesian standard
|
|
55
|
-
* ',' // International standard
|
|
56
|
-
* ' ' // Space separator
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
separator?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Decimal separator character.
|
|
62
|
-
*
|
|
63
|
-
* @defaultValue ','
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* ',' // Indonesian standard
|
|
68
|
-
* '.' // International standard
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
decimalSeparator?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Number of decimal places to show.
|
|
74
|
-
*
|
|
75
|
-
* @defaultValue 0
|
|
76
|
-
*/
|
|
77
|
-
precision?: number;
|
|
78
|
-
/**
|
|
79
|
-
* Whether to add space after 'Rp' symbol.
|
|
80
|
-
*
|
|
81
|
-
* @defaultValue true
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* true // 'Rp 1.500.000'
|
|
86
|
-
* false // 'Rp1.500.000'
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
spaceAfterSymbol?: boolean;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Options for converting numbers to Indonesian words (terbilang).
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* Default:
|
|
96
|
-
* ```typescript
|
|
97
|
-
* toWords(1500000); // 'satu juta lima ratus ribu rupiah'
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* Uppercase:
|
|
102
|
-
* ```typescript
|
|
103
|
-
* toWords(1500000, { uppercase: true });
|
|
104
|
-
* // 'Satu juta lima ratus ribu rupiah'
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* Without currency suffix:
|
|
109
|
-
* ```typescript
|
|
110
|
-
* toWords(1500000, { withCurrency: false });
|
|
111
|
-
* // 'satu juta lima ratus ribu'
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
interface WordOptions {
|
|
117
|
-
/**
|
|
118
|
-
* Whether to capitalize the first letter.
|
|
119
|
-
*
|
|
120
|
-
* @defaultValue false
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* false // 'satu juta'
|
|
125
|
-
* true // 'Satu juta'
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
uppercase?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Whether to add 'rupiah' at the end.
|
|
131
|
-
*
|
|
132
|
-
* @defaultValue true
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```typescript
|
|
136
|
-
* true // 'satu juta rupiah'
|
|
137
|
-
* false // 'satu juta'
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
withCurrency?: boolean;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Unit for rounding currency amounts.
|
|
144
|
-
*
|
|
145
|
-
* Common Indonesian currency rounding units:
|
|
146
|
-
* - `'ribu'`: Round to thousands (1.000)
|
|
147
|
-
* - `'ratus-ribu'`: Round to hundred thousands (100.000)
|
|
148
|
-
* - `'juta'`: Round to millions (1.000.000)
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* ```typescript
|
|
152
|
-
* roundToClean(1234567, 'ribu'); // 1235000
|
|
153
|
-
* roundToClean(1234567, 'ratus-ribu'); // 1200000
|
|
154
|
-
* roundToClean(1234567, 'juta'); // 1000000
|
|
155
|
-
* ```
|
|
156
|
-
*
|
|
157
|
-
* @public
|
|
158
|
-
*/
|
|
159
|
-
type RoundUnit = 'ribu' | 'ratus-ribu' | 'juta';
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Currency formatting utilities for Indonesian Rupiah.
|
|
163
|
-
*
|
|
164
|
-
* @module currency/format
|
|
165
|
-
* @packageDocumentation
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Formats a number as Indonesian Rupiah currency.
|
|
170
|
-
*
|
|
171
|
-
* Provides flexible formatting options including symbol display,
|
|
172
|
-
* decimal places, and custom separators.
|
|
173
|
-
*
|
|
174
|
-
* @param amount - The amount to format
|
|
175
|
-
* @param options - Formatting options
|
|
176
|
-
* @returns Formatted Rupiah string
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* Basic formatting:
|
|
180
|
-
* ```typescript
|
|
181
|
-
* formatRupiah(1500000); // 'Rp 1.500.000'
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* With decimals:
|
|
186
|
-
* ```typescript
|
|
187
|
-
* formatRupiah(1500000.50, { decimal: true }); // 'Rp 1.500.000,50'
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* Without symbol:
|
|
192
|
-
* ```typescript
|
|
193
|
-
* formatRupiah(1500000, { symbol: false }); // '1.500.000'
|
|
194
|
-
* ```
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* Custom separators:
|
|
198
|
-
* ```typescript
|
|
199
|
-
* formatRupiah(1500000, { separator: ',' }); // 'Rp 1,500,000'
|
|
200
|
-
* ```
|
|
201
|
-
*
|
|
202
|
-
* @public
|
|
203
|
-
*/
|
|
204
|
-
declare function formatRupiah(amount: number, options?: RupiahOptions): string;
|
|
205
|
-
/**
|
|
206
|
-
* Formats a number in compact Indonesian format.
|
|
207
|
-
*
|
|
208
|
-
* Uses Indonesian units: ribu, juta, miliar, triliun.
|
|
209
|
-
* Follows Indonesian grammar rules (e.g., "1 juta" not "1,0 juta").
|
|
210
|
-
*
|
|
211
|
-
* @param amount - The amount to format
|
|
212
|
-
* @returns Compact formatted string
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* Millions:
|
|
216
|
-
* ```typescript
|
|
217
|
-
* formatCompact(1500000); // 'Rp 1,5 juta'
|
|
218
|
-
* formatCompact(1000000); // 'Rp 1 juta'
|
|
219
|
-
* ```
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* Thousands:
|
|
223
|
-
* ```typescript
|
|
224
|
-
* formatCompact(500000); // 'Rp 500 ribu'
|
|
225
|
-
* ```
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* Small numbers:
|
|
229
|
-
* ```typescript
|
|
230
|
-
* formatCompact(1500); // 'Rp 1.500'
|
|
231
|
-
* ```
|
|
232
|
-
*
|
|
233
|
-
* @public
|
|
234
|
-
*/
|
|
235
|
-
declare function formatCompact(amount: number): string;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Currency parsing utilities for Indonesian Rupiah.
|
|
239
|
-
*
|
|
240
|
-
* @module currency/parse
|
|
241
|
-
* @packageDocumentation
|
|
242
|
-
*/
|
|
243
|
-
/**
|
|
244
|
-
* Parses a formatted Rupiah string back to a number.
|
|
245
|
-
*
|
|
246
|
-
* Handles multiple formats:
|
|
247
|
-
* - Standard: "Rp 1.500.000"
|
|
248
|
-
* - No symbol: "1.500.000"
|
|
249
|
-
* - With decimals: "Rp 1.500.000,50"
|
|
250
|
-
* - Compact: "Rp 1,5 juta", "Rp 500 ribu"
|
|
251
|
-
*
|
|
252
|
-
* @param formatted - The formatted Rupiah string to parse
|
|
253
|
-
* @returns Parsed number, or null if invalid
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* Standard format:
|
|
257
|
-
* ```typescript
|
|
258
|
-
* parseRupiah('Rp 1.500.000'); // 1500000
|
|
259
|
-
* ```
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* With decimals:
|
|
263
|
-
* ```typescript
|
|
264
|
-
* parseRupiah('Rp 1.500.000,50'); // 1500000.50
|
|
265
|
-
* ```
|
|
266
|
-
*
|
|
267
|
-
* @example
|
|
268
|
-
* Compact format:
|
|
269
|
-
* ```typescript
|
|
270
|
-
* parseRupiah('Rp 1,5 juta'); // 1500000
|
|
271
|
-
* parseRupiah('Rp 500 ribu'); // 500000
|
|
272
|
-
* ```
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* Invalid input:
|
|
276
|
-
* ```typescript
|
|
277
|
-
* parseRupiah('invalid'); // null
|
|
278
|
-
* ```
|
|
279
|
-
*
|
|
280
|
-
* @public
|
|
281
|
-
*/
|
|
282
|
-
declare function parseRupiah(formatted: string): number | null;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Convert numbers to Indonesian words (terbilang).
|
|
286
|
-
*
|
|
287
|
-
* @module currency/words
|
|
288
|
-
* @packageDocumentation
|
|
289
|
-
*/
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Converts a number to Indonesian words (terbilang).
|
|
293
|
-
*
|
|
294
|
-
* Supports numbers up to trillions (triliun).
|
|
295
|
-
* Follows Indonesian language rules for number pronunciation.
|
|
296
|
-
*
|
|
297
|
-
* Special rules:
|
|
298
|
-
* - 1 = "satu" in most cases, but "se-" for 100, 1000
|
|
299
|
-
* - 11 = "sebelas" (not "satu belas")
|
|
300
|
-
* - 100 = "seratus" (not "satu ratus")
|
|
301
|
-
* - 1000 = "seribu" (not "satu ribu")
|
|
302
|
-
*
|
|
303
|
-
* @param amount - The number to convert
|
|
304
|
-
* @param options - Conversion options
|
|
305
|
-
* @returns Indonesian words representation
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* Basic numbers:
|
|
309
|
-
* ```typescript
|
|
310
|
-
* toWords(123); // 'seratus dua puluh tiga rupiah'
|
|
311
|
-
* ```
|
|
312
|
-
*
|
|
313
|
-
* @example
|
|
314
|
-
* Large numbers:
|
|
315
|
-
* ```typescript
|
|
316
|
-
* toWords(1500000); // 'satu juta lima ratus ribu rupiah'
|
|
317
|
-
* ```
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* With options:
|
|
321
|
-
* ```typescript
|
|
322
|
-
* toWords(1500000, { uppercase: true });
|
|
323
|
-
* // 'Satu juta lima ratus ribu rupiah'
|
|
324
|
-
*
|
|
325
|
-
* toWords(1500000, { withCurrency: false });
|
|
326
|
-
* // 'satu juta lima ratus ribu'
|
|
327
|
-
* ```
|
|
328
|
-
*
|
|
329
|
-
* @public
|
|
330
|
-
*/
|
|
331
|
-
declare function toWords(amount: number, options?: WordOptions): string;
|
|
332
|
-
|
|
333
|
-
export { type RupiahOptions as R, type WordOptions as W, formatCompact as a, type RoundUnit as b, formatRupiah as f, parseRupiah as p, toWords as t };
|