@ix-xs/node-comfort 1.1.31 → 2.0.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/LICENSE +21 -0
  3. package/README.md +210 -748
  4. package/index.js +84 -13
  5. package/package.json +201 -21
  6. package/src/Arr.js +901 -0
  7. package/src/Async.js +585 -0
  8. package/src/Cache.js +329 -0
  9. package/src/Checker.js +979 -188
  10. package/src/Cli.js +1034 -0
  11. package/src/Color.js +415 -0
  12. package/src/Crypto.js +707 -0
  13. package/src/Emitter.js +289 -0
  14. package/src/Env.js +555 -0
  15. package/src/FS.js +1483 -768
  16. package/src/Func.js +692 -0
  17. package/src/Http.js +538 -0
  18. package/src/Id.js +418 -0
  19. package/src/Logger.js +739 -307
  20. package/src/Num.js +849 -0
  21. package/src/Obj.js +904 -0
  22. package/src/SQLite.js +1308 -994
  23. package/src/Schema.js +1586 -0
  24. package/src/Str.js +999 -0
  25. package/src/Sys.js +511 -0
  26. package/src/Time.js +1323 -0
  27. package/src/Utils.js +321 -325
  28. package/src/errors.js +292 -0
  29. package/types/index.d.ts +693 -120
  30. package/types/src/Arr.d.ts +562 -0
  31. package/types/src/Arr.d.ts.map +1 -0
  32. package/types/src/Async.d.ts +321 -0
  33. package/types/src/Async.d.ts.map +1 -0
  34. package/types/src/Cache.d.ts +195 -0
  35. package/types/src/Cache.d.ts.map +1 -0
  36. package/types/src/Checker.d.ts +609 -81
  37. package/types/src/Checker.d.ts.map +1 -1
  38. package/types/src/Cli.d.ts +582 -0
  39. package/types/src/Cli.d.ts.map +1 -0
  40. package/types/src/Color.d.ts +294 -0
  41. package/types/src/Color.d.ts.map +1 -0
  42. package/types/src/Crypto.d.ts +534 -0
  43. package/types/src/Crypto.d.ts.map +1 -0
  44. package/types/src/Emitter.d.ts +170 -0
  45. package/types/src/Emitter.d.ts.map +1 -0
  46. package/types/src/Env.d.ts +382 -0
  47. package/types/src/Env.d.ts.map +1 -0
  48. package/types/src/FS.d.ts +709 -201
  49. package/types/src/FS.d.ts.map +1 -1
  50. package/types/src/Func.d.ts +455 -0
  51. package/types/src/Func.d.ts.map +1 -0
  52. package/types/src/Http.d.ts +374 -0
  53. package/types/src/Http.d.ts.map +1 -0
  54. package/types/src/Id.d.ts +200 -0
  55. package/types/src/Id.d.ts.map +1 -0
  56. package/types/src/Logger.d.ts +374 -24
  57. package/types/src/Logger.d.ts.map +1 -1
  58. package/types/src/Num.d.ts +578 -0
  59. package/types/src/Num.d.ts.map +1 -0
  60. package/types/src/Obj.d.ts +475 -0
  61. package/types/src/Obj.d.ts.map +1 -0
  62. package/types/src/SQLite.d.ts +647 -305
  63. package/types/src/SQLite.d.ts.map +1 -1
  64. package/types/src/Schema.d.ts +940 -0
  65. package/types/src/Schema.d.ts.map +1 -0
  66. package/types/src/Str.d.ts +696 -0
  67. package/types/src/Str.d.ts.map +1 -0
  68. package/types/src/Sys.d.ts +269 -0
  69. package/types/src/Sys.d.ts.map +1 -0
  70. package/types/src/Time.d.ts +664 -0
  71. package/types/src/Time.d.ts.map +1 -0
  72. package/types/src/Utils.d.ts +154 -102
  73. package/types/src/Utils.d.ts.map +1 -1
  74. package/types/src/errors.d.ts +292 -0
  75. package/types/src/errors.d.ts.map +1 -0
  76. package/tsconfig.json +0 -18
  77. package/types/index.d.ts.map +0 -1
@@ -0,0 +1,578 @@
1
+ /**
2
+ * Options for `formatBytes()`.
3
+ */
4
+ export type FormatBytesOptions = {
5
+ /**
6
+ * Maximum decimals. Defaults to `1`.
7
+ */
8
+ decimals?: number | undefined;
9
+ /**
10
+ * 1 KB is 1024 bytes when `true`, 1000 when `false`. Defaults to `true`.
11
+ */
12
+ binary?: boolean | undefined;
13
+ /**
14
+ * Use `KiB`, `MiB`, `GiB` labels.
15
+ */
16
+ iec?: boolean | undefined;
17
+ /**
18
+ * Formats the number for a language, like `"fr"` for `"1,5 KB"`.
19
+ */
20
+ locale?: string | undefined;
21
+ /**
22
+ * Your own labels from bytes up, like `["o", "Ko", "Mo", "Go", "To"]`.
23
+ */
24
+ units?: string[] | undefined;
25
+ };
26
+ /**
27
+ * Options for `parseBytes()`.
28
+ */
29
+ export type ParseBytesOptions = {
30
+ /**
31
+ * 1 KB is 1024 bytes when `true`, 1000 when `false`. `KiB` units are always 1024. Defaults to `true`.
32
+ */
33
+ binary?: boolean | undefined;
34
+ };
35
+ /**
36
+ * Options for `format()`.
37
+ */
38
+ export type FormatNumberOptions = {
39
+ /**
40
+ * Language, like `"fr"` or `"en-US"`. Defaults to the one set with `setLocale()`, or `"en"`.
41
+ */
42
+ locale?: string | undefined;
43
+ /**
44
+ * Exact number of decimals.
45
+ */
46
+ decimals?: number | undefined;
47
+ /**
48
+ * Minimum decimals.
49
+ */
50
+ minDecimals?: number | undefined;
51
+ /**
52
+ * Maximum decimals. Defaults to `3`.
53
+ */
54
+ maxDecimals?: number | undefined;
55
+ /**
56
+ * Short notation like `1.2K` or `3.4M`.
57
+ */
58
+ compact?: boolean | undefined;
59
+ /**
60
+ * `"percent"` multiplies by 100 and adds `%`.
61
+ */
62
+ style?: "decimal" | "percent" | undefined;
63
+ /**
64
+ * Any `Intl` unit: `"kilometer"`, `"celsius"`, `"megabyte"`...
65
+ */
66
+ unit?: string | undefined;
67
+ /**
68
+ * How the unit is written. Defaults to `"short"`.
69
+ */
70
+ unitDisplay?: "long" | "short" | "narrow" | undefined;
71
+ /**
72
+ * When to show the sign. `"exceptZero"` gives `+5`.
73
+ */
74
+ signDisplay?: "always" | "auto" | "never" | "exceptZero" | undefined;
75
+ /**
76
+ * Thousands separators. Defaults to `true`.
77
+ */
78
+ grouping?: boolean | undefined;
79
+ };
80
+ /**
81
+ * Options for `currency()`.
82
+ */
83
+ export type CurrencyOptions = {
84
+ /**
85
+ * Language. Defaults to the one set with `setLocale()`, or `"en"`.
86
+ */
87
+ locale?: string | undefined;
88
+ /**
89
+ * Defaults to the currency's usual decimals (2 for EUR, 0 for JPY).
90
+ */
91
+ decimals?: number | undefined;
92
+ /**
93
+ * `€`, `€`, `EUR` or `euros`. Defaults to `"symbol"`.
94
+ */
95
+ display?: "symbol" | "code" | "name" | "narrowSymbol" | undefined;
96
+ /**
97
+ * Show negative amounts in parentheses, like `($5.00)`.
98
+ */
99
+ accounting?: boolean | undefined;
100
+ };
101
+ /**
102
+ * Options for `ordinal()`.
103
+ */
104
+ export type OrdinalOptions = {
105
+ /**
106
+ * Built in: `en`, `fr`, `es`, `it`, `pt`, `de`, `nl`. Defaults to the one set with `setLocale()`, or `"en"`.
107
+ */
108
+ locale?: string | undefined;
109
+ /**
110
+ * Your own suffixes, for other languages.
111
+ */
112
+ suffixes?: Partial<Record<Intl.LDMLPluralRule, string>> | undefined;
113
+ };
114
+ /**
115
+ * Options for `variance()` and `stdDev()`.
116
+ */
117
+ export type VarianceOptions = {
118
+ /**
119
+ * Sample statistic (divides by n - 1) instead of population.
120
+ */
121
+ sample?: boolean | undefined;
122
+ };
123
+ /**
124
+ * Sets the default language of `format`, `currency`, `percent`,
125
+ * `abbreviate`, `ordinal` and `formatBytes`.
126
+ *
127
+ * @example
128
+ * num.setLocale("fr");
129
+ * num.currency(1234.5, "EUR"); // "1 234,50 €"
130
+ *
131
+ * @param {string} locale Like `"fr"`, `"en-GB"` or `"pt-BR"`.
132
+ * @returns {typeof import("./Num")} The module, so calls chain.
133
+ */
134
+ export function setLocale(locale: string): typeof import("./Num");
135
+ /**
136
+ * The current default language.
137
+ *
138
+ * @example
139
+ * num.getLocale(); // "en"
140
+ *
141
+ * @returns {string}
142
+ */
143
+ export function getLocale(): string;
144
+ /**
145
+ * Keeps a number between `min` and `max`.
146
+ *
147
+ * @example
148
+ * num.clamp(150, 0, 100); // 100
149
+ * num.clamp(-5, 0, 100); // 0
150
+ *
151
+ * @param {number} value
152
+ * @param {number} min
153
+ * @param {number} max
154
+ * @returns {number}
155
+ */
156
+ export function clamp(value: number, min: number, max: number): number;
157
+ /**
158
+ * Is the number between `min` and `max`, both included?
159
+ *
160
+ * @example
161
+ * num.inRange(10, 0, 10); // true
162
+ *
163
+ * @param {number} value
164
+ * @param {number} min
165
+ * @param {number} max
166
+ * @returns {boolean}
167
+ */
168
+ export function inRange(value: number, min: number, max: number): boolean;
169
+ /**
170
+ * Wraps a number around a range, like an angle or a carousel index.
171
+ * `max` is excluded.
172
+ *
173
+ * @example
174
+ * num.wrap(370, 0, 360); // 10
175
+ * num.wrap(-1, 0, 5); // 4
176
+ *
177
+ * @param {number} value
178
+ * @param {number} min
179
+ * @param {number} max
180
+ * @returns {number}
181
+ */
182
+ export function wrap(value: number, min: number, max: number): number;
183
+ /**
184
+ * Rounds to `decimals` places without floating-point surprises:
185
+ * `Math.round(1.005 * 100) / 100` gives `1`, this gives `1.01`. Halves round
186
+ * away from zero, like in a spreadsheet.
187
+ *
188
+ * @example
189
+ * num.round(1.005, 2); // 1.01
190
+ * num.round(1234, -2); // 1200
191
+ * num.round(-2.5); // -3
192
+ *
193
+ * @param {number} value
194
+ * @param {number} [decimals=0] Negative values round to tens, hundreds...
195
+ * @returns {number}
196
+ */
197
+ export function round(value: number, decimals?: number): number;
198
+ /**
199
+ * Rounds down to `decimals` places.
200
+ *
201
+ * @example
202
+ * num.floor(1.789, 2); // 1.78
203
+ *
204
+ * @param {number} value
205
+ * @param {number} [decimals=0]
206
+ * @returns {number}
207
+ */
208
+ export function floor(value: number, decimals?: number): number;
209
+ /**
210
+ * Rounds up to `decimals` places.
211
+ *
212
+ * @example
213
+ * num.ceil(1.231, 2); // 1.24
214
+ *
215
+ * @param {number} value
216
+ * @param {number} [decimals=0]
217
+ * @returns {number}
218
+ */
219
+ export function ceil(value: number, decimals?: number): number;
220
+ /**
221
+ * Rounds to the nearest multiple of `step`.
222
+ *
223
+ * @example
224
+ * num.snap(17, 5); // 15
225
+ * num.snap(0.37, 0.25); // 0.25
226
+ *
227
+ * @param {number} value
228
+ * @param {number} step
229
+ * @returns {number}
230
+ */
231
+ export function snap(value: number, step: number): number;
232
+ /**
233
+ * Are two numbers equal within a small tolerance? The right way to compare
234
+ * float results, since `0.1 + 0.2 === 0.3` is `false`.
235
+ *
236
+ * @example
237
+ * num.approxEqual(0.1 + 0.2, 0.3); // true
238
+ *
239
+ * @param {number} a
240
+ * @param {number} b
241
+ * @param {number} [epsilon=Number.EPSILON * 16] Allowed difference, relative to the size of the numbers.
242
+ * @returns {boolean}
243
+ */
244
+ export function approxEqual(a: number, b: number, epsilon?: number): boolean;
245
+ /**
246
+ * The value at ratio `t` between `start` and `end`.
247
+ *
248
+ * @example
249
+ * num.lerp(0, 100, 0.25); // 25
250
+ *
251
+ * @param {number} start
252
+ * @param {number} end
253
+ * @param {number} t Usually between 0 and 1.
254
+ * @returns {number}
255
+ */
256
+ export function lerp(start: number, end: number, t: number): number;
257
+ /**
258
+ * Moves a number from one range to another, keeping its relative position.
259
+ *
260
+ * @example
261
+ * num.mapRange(5, 0, 10, 0, 100); // 50
262
+ * num.mapRange(75, 0, 100, 1, 0); // 0.25
263
+ *
264
+ * @param {number} value
265
+ * @param {number} inMin
266
+ * @param {number} inMax
267
+ * @param {number} outMin
268
+ * @param {number} outMax
269
+ * @returns {number}
270
+ */
271
+ export function mapRange(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
272
+ /**
273
+ * A random float from `min` (included) to `max` (excluded). Not for
274
+ * security: it uses `Math.random`.
275
+ *
276
+ * @example
277
+ * num.random(10, 20); // 13.84...
278
+ *
279
+ * @param {number} [min=0]
280
+ * @param {number} [max=1]
281
+ * @returns {number}
282
+ */
283
+ export function random(min?: number, max?: number): number;
284
+ /**
285
+ * A random integer from `min` to `max`, both included. Not for security.
286
+ *
287
+ * @example
288
+ * num.randomInt(1, 6); // a dice roll
289
+ *
290
+ * @param {number} min
291
+ * @param {number} max
292
+ * @returns {number}
293
+ */
294
+ export function randomInt(min: number, max: number): number;
295
+ /**
296
+ * Adds up numbers.
297
+ *
298
+ * @example
299
+ * num.sum([1, 2, 3]); // 6
300
+ *
301
+ * @param {Iterable<number>} values
302
+ * @returns {number}
303
+ */
304
+ export function sum(values: Iterable<number>): number;
305
+ /**
306
+ * The mean, or `0` for an empty list.
307
+ *
308
+ * @example
309
+ * num.average([2, 4, 9]); // 5
310
+ *
311
+ * @param {Iterable<number>} values
312
+ * @returns {number}
313
+ */
314
+ export function average(values: Iterable<number>): number;
315
+ /**
316
+ * The middle value once sorted, or `0` for an empty list.
317
+ *
318
+ * @example
319
+ * num.median([3, 1, 2]); // 2
320
+ * num.median([1, 2, 3, 4]); // 2.5
321
+ *
322
+ * @param {Iterable<number>} values
323
+ * @returns {number}
324
+ */
325
+ export function median(values: Iterable<number>): number;
326
+ /**
327
+ * The most frequent values.
328
+ *
329
+ * @example
330
+ * num.mode([1, 1, 2, 2, 3]); // [1, 2]
331
+ *
332
+ * @param {Iterable<number>} values
333
+ * @returns {number[]}
334
+ */
335
+ export function mode(values: Iterable<number>): number[];
336
+ /**
337
+ * The variance: the average squared distance from the mean.
338
+ *
339
+ * @example
340
+ * num.variance([2, 4, 4, 4, 5, 5, 7, 9]); // 4
341
+ *
342
+ * @param {Iterable<number>} values
343
+ * @param {VarianceOptions} [options]
344
+ * @returns {number}
345
+ */
346
+ export function variance(values: Iterable<number>, options?: VarianceOptions): number;
347
+ /**
348
+ * The standard deviation.
349
+ *
350
+ * @example
351
+ * num.stdDev([2, 4, 4, 4, 5, 5, 7, 9]); // 2
352
+ *
353
+ * @param {Iterable<number>} values
354
+ * @param {VarianceOptions} [options]
355
+ * @returns {number}
356
+ */
357
+ export function stdDev(values: Iterable<number>, options?: VarianceOptions): number;
358
+ /**
359
+ * The value under which `p` percent of the values fall, interpolated like
360
+ * Excel's `PERCENTILE.INC`.
361
+ *
362
+ * @example
363
+ * num.percentile([1, 2, 3, 4, 5], 90); // 4.6
364
+ * num.percentile(responseTimes, 95); // p95 latency
365
+ *
366
+ * @param {Iterable<number>} values
367
+ * @param {number} p From 0 to 100.
368
+ * @returns {number} `NaN` for an empty list.
369
+ */
370
+ export function percentile(values: Iterable<number>, p: number): number;
371
+ /**
372
+ * The smallest number. Unlike `Math.min(...array)`, huge arrays are fine.
373
+ *
374
+ * @param {Iterable<number>} values
375
+ * @returns {number | undefined} `undefined` for an empty list.
376
+ */
377
+ export function min(values: Iterable<number>): number | undefined;
378
+ /**
379
+ * The largest number. Unlike `Math.max(...array)`, huge arrays are fine.
380
+ *
381
+ * @param {Iterable<number>} values
382
+ * @returns {number | undefined} `undefined` for an empty list.
383
+ */
384
+ export function max(values: Iterable<number>): number | undefined;
385
+ /**
386
+ * What percentage `value` is of `total`. Returns `0` when `total` is `0`.
387
+ *
388
+ * @example
389
+ * num.percent(25, 200); // 12.5
390
+ * num.percent(1, 3, 1); // 33.3
391
+ *
392
+ * @param {number} value
393
+ * @param {number} total
394
+ * @param {number} [decimals=2]
395
+ * @returns {number}
396
+ */
397
+ export function percent(value: number, total: number, decimals?: number): number;
398
+ /**
399
+ * Greatest common divisor.
400
+ *
401
+ * @example
402
+ * num.gcd(12, 18, 27); // 3
403
+ *
404
+ * @param {...number} values
405
+ * @returns {number}
406
+ */
407
+ export function gcd(...values: number[]): number;
408
+ /**
409
+ * Least common multiple.
410
+ *
411
+ * @example
412
+ * num.lcm(2, 3, 4); // 12
413
+ *
414
+ * @param {...number} values
415
+ * @returns {number}
416
+ */
417
+ export function lcm(...values: number[]): number;
418
+ /**
419
+ * Is it a prime number?
420
+ *
421
+ * @example
422
+ * num.isPrime(7); // true
423
+ * num.isPrime(1); // false
424
+ *
425
+ * @param {number} value
426
+ * @returns {boolean}
427
+ */
428
+ export function isPrime(value: number): boolean;
429
+ /**
430
+ * `n!`. Pass `true` to get an exact bigint, since numbers lose precision
431
+ * past 18!.
432
+ *
433
+ * @example
434
+ * num.factorial(5); // 120
435
+ * num.factorial(25, true); // 15511210043330985984000000n
436
+ *
437
+ * @param {number} n
438
+ * @param {boolean} [asBigInt=false]
439
+ * @returns {number | bigint}
440
+ * @throws {RangeError} If `n` is negative or not an integer.
441
+ */
442
+ export function factorial(n: number, asBigInt?: boolean): number | bigint;
443
+ /**
444
+ * Is it even?
445
+ *
446
+ * @param {number} value
447
+ * @returns {boolean}
448
+ */
449
+ export function isEven(value: number): boolean;
450
+ /**
451
+ * Is it odd? Negative numbers work too.
452
+ *
453
+ * @param {number} value
454
+ * @returns {boolean}
455
+ */
456
+ export function isOdd(value: number): boolean;
457
+ /**
458
+ * Numbers from `start` up to `end` (excluded). With one argument, counts
459
+ * from 0. Goes down when `end` is smaller.
460
+ *
461
+ * @example
462
+ * num.range(4); // [0, 1, 2, 3]
463
+ * num.range(0, 10, 2); // [0, 2, 4, 6, 8]
464
+ * num.range(5, 0); // [5, 4, 3, 2, 1]
465
+ *
466
+ * @param {number} start
467
+ * @param {number} [end]
468
+ * @param {number} [step] Defaults to `1`, or `-1` when counting down.
469
+ * @returns {number[]}
470
+ */
471
+ export function range(start: number, end?: number, step?: number): number[];
472
+ /**
473
+ * Reads a number from anything, ignoring trailing text like units.
474
+ *
475
+ * @example
476
+ * num.parse("42px"); // 42
477
+ * num.parse(" -3.5 kg"); // -3.5
478
+ * num.parse("nope", 0); // 0
479
+ *
480
+ * @param {unknown} value
481
+ * @param {number} [fallback=NaN] Returned when there's no number to read.
482
+ * @returns {number}
483
+ */
484
+ export function parse(value: unknown, fallback?: number): number;
485
+ /**
486
+ * Turns a size like `"10 MB"` into bytes. The opposite of `formatBytes()`.
487
+ *
488
+ * @example
489
+ * num.parseBytes("1.5 KB"); // 1536
490
+ * num.parseBytes("2 GiB"); // 2147483648
491
+ * num.parseBytes("1 KB", { binary: false }); // 1000
492
+ *
493
+ * @param {string | number} value A size like `"512kb"` or `"1.5G"`, or a number of bytes.
494
+ * @param {ParseBytesOptions} [options]
495
+ * @returns {number} Bytes, or `NaN` if it can't be read.
496
+ */
497
+ export function parseBytes(value: string | number, options?: ParseBytesOptions): number;
498
+ /**
499
+ * Formats a byte count as a readable size.
500
+ *
501
+ * @example
502
+ * num.formatBytes(1536); // "1.5 KB"
503
+ * num.formatBytes(1000, { binary: false }); // "1 KB"
504
+ * num.formatBytes(1536, { locale: "fr", units: ["o", "Ko", "Mo", "Go"] }); // "1,5 Ko"
505
+ *
506
+ * @param {number} bytes
507
+ * @param {FormatBytesOptions} [options]
508
+ * @returns {string}
509
+ */
510
+ export function formatBytes(bytes: number, options?: FormatBytesOptions): string;
511
+ /**
512
+ * Formats a number for display, with `Intl.NumberFormat` doing the work:
513
+ * separators, decimals, compact notation, percentages, units.
514
+ *
515
+ * @example
516
+ * num.format(1234567.891); // "1,234,567.891"
517
+ * num.format(1234567.891, { locale: "fr" }); // "1 234 567,891"
518
+ * num.format(0.256, { style: "percent" }); // "26%"
519
+ * num.format(1500, { compact: true }); // "1.5K"
520
+ * num.format(3.5, { unit: "kilometer" }); // "3.5 km"
521
+ *
522
+ * @param {number | bigint} value
523
+ * @param {FormatNumberOptions} [options]
524
+ * @returns {string}
525
+ */
526
+ export function format(value: number | bigint, options?: FormatNumberOptions): string;
527
+ /**
528
+ * Formats an amount of money.
529
+ *
530
+ * @example
531
+ * num.currency(1234.5, "USD"); // "$1,234.50"
532
+ * num.currency(1234.5, "EUR", { locale: "fr" }); // "1 234,50 €"
533
+ * num.currency(-5, "USD", { accounting: true }); // "($5.00)"
534
+ *
535
+ * @param {number | bigint} value
536
+ * @param {string} code A currency code like `"EUR"`, `"USD"` or `"JPY"`.
537
+ * @param {CurrencyOptions} [options]
538
+ * @returns {string}
539
+ */
540
+ export function currency(value: number | bigint, code: string, options?: CurrencyOptions): string;
541
+ /**
542
+ * Shortens big numbers with `K`, `M`, `B` or `T`. For other languages, use
543
+ * `format(value, { compact: true, locale })`.
544
+ *
545
+ * @example
546
+ * num.abbreviate(1500); // "1.5K"
547
+ * num.abbreviate(2_400_000); // "2.4M"
548
+ *
549
+ * @param {number} value
550
+ * @param {number} [decimals=1]
551
+ * @returns {string}
552
+ */
553
+ export function abbreviate(value: number, decimals?: number): string;
554
+ /**
555
+ * Adds thousands separators, leaving decimals alone.
556
+ *
557
+ * @example
558
+ * num.thousands(1234567.89, " "); // "1 234 567.89"
559
+ *
560
+ * @param {number | string} value
561
+ * @param {string} [separator=","]
562
+ * @returns {string}
563
+ */
564
+ export function thousands(value: number | string, separator?: string): string;
565
+ /**
566
+ * Adds the ordinal suffix: 1st, 2nd, 3rd... in several languages.
567
+ *
568
+ * @example
569
+ * num.ordinal(22); // "22nd"
570
+ * num.ordinal(1, { locale: "fr" }); // "1er"
571
+ * num.ordinal(3, { locale: "de" }); // "3."
572
+ *
573
+ * @param {number} value
574
+ * @param {OrdinalOptions} [options]
575
+ * @returns {string}
576
+ */
577
+ export function ordinal(value: number, options?: OrdinalOptions): string;
578
+ //# sourceMappingURL=Num.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Num.d.ts","sourceRoot":"","sources":["../../src/Num.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4wBA;;;;;;;;;;GAUG;AACH,kCAHW,MAAM,GACJ,cAAc,OAAO,CAAC,CAKlC;AAED;;;;;;;GAOG;AACH,6BAFa,MAAM,CAIlB;AA3rBD;;;;;;;;;;;GAWG;AACH,6BALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;GAUG;AACH,+BALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAInB;AAED;;;;;;;;;;;;GAYG;AACH,4BALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,MAAM,CAMlB;AAED;;;;;;;;;;;;;GAaG;AACH,6BAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;GASG;AACH,6BAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;GASG;AACH,4BAJW,MAAM,aACN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