@budiauktioner/buildi-primitives 0.1.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 (107) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +253 -0
  4. package/THIRD_PARTY_NOTICES.md +52 -0
  5. package/dist/banking/index.cjs +6491 -0
  6. package/dist/banking/index.cjs.map +1 -0
  7. package/dist/banking/index.d.cts +58 -0
  8. package/dist/banking/index.d.ts +58 -0
  9. package/dist/banking/index.js +6464 -0
  10. package/dist/banking/index.js.map +1 -0
  11. package/dist/contact/index.cjs +6678 -0
  12. package/dist/contact/index.cjs.map +1 -0
  13. package/dist/contact/index.d.cts +709 -0
  14. package/dist/contact/index.d.ts +709 -0
  15. package/dist/contact/index.js +6586 -0
  16. package/dist/contact/index.js.map +1 -0
  17. package/dist/country-BhD51LDL.d.cts +433 -0
  18. package/dist/country-p0n0EVQ9.d.ts +433 -0
  19. package/dist/finance/index.cjs +3592 -0
  20. package/dist/finance/index.cjs.map +1 -0
  21. package/dist/finance/index.d.cts +83 -0
  22. package/dist/finance/index.d.ts +83 -0
  23. package/dist/finance/index.js +3584 -0
  24. package/dist/finance/index.js.map +1 -0
  25. package/dist/geography/index.cjs +4227 -0
  26. package/dist/geography/index.cjs.map +1 -0
  27. package/dist/geography/index.d.cts +34 -0
  28. package/dist/geography/index.d.ts +34 -0
  29. package/dist/geography/index.js +4202 -0
  30. package/dist/geography/index.js.map +1 -0
  31. package/dist/index.cjs +14087 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.cts +75 -0
  34. package/dist/index.d.ts +75 -0
  35. package/dist/index.js +13868 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/isin-EeVPpNWu.d.ts +39 -0
  38. package/dist/isin-ZlQLBVm8.d.cts +39 -0
  39. package/dist/organization/index.cjs +2376 -0
  40. package/dist/organization/index.cjs.map +1 -0
  41. package/dist/organization/index.d.cts +117 -0
  42. package/dist/organization/index.d.ts +117 -0
  43. package/dist/organization/index.js +2346 -0
  44. package/dist/organization/index.js.map +1 -0
  45. package/dist/person/index.cjs +1144 -0
  46. package/dist/person/index.cjs.map +1 -0
  47. package/dist/person/index.d.cts +60 -0
  48. package/dist/person/index.d.ts +60 -0
  49. package/dist/person/index.js +1125 -0
  50. package/dist/person/index.js.map +1 -0
  51. package/dist/person-full-name-Cmc9Ynuc.d.cts +82 -0
  52. package/dist/person-full-name-D6Hbsab6.d.ts +82 -0
  53. package/dist/phone-number-C24--ggy.d.ts +139 -0
  54. package/dist/phone-number-DZ-YxCQQ.d.cts +139 -0
  55. package/dist/property/index.cjs +487 -0
  56. package/dist/property/index.cjs.map +1 -0
  57. package/dist/property/index.d.cts +56 -0
  58. package/dist/property/index.d.ts +56 -0
  59. package/dist/property/index.js +480 -0
  60. package/dist/property/index.js.map +1 -0
  61. package/dist/sample-data/index.cjs +12310 -0
  62. package/dist/sample-data/index.cjs.map +1 -0
  63. package/dist/sample-data/index.d.cts +260 -0
  64. package/dist/sample-data/index.d.ts +260 -0
  65. package/dist/sample-data/index.js +12302 -0
  66. package/dist/sample-data/index.js.map +1 -0
  67. package/dist/swedish-address-DNC3ftRF.d.cts +297 -0
  68. package/dist/swedish-address-GMzjqgxb.d.ts +297 -0
  69. package/dist/swedish-bank-account-holder-name-BFJ8h1aO.d.cts +45 -0
  70. package/dist/swedish-bank-account-holder-name-CAAru07F.d.ts +45 -0
  71. package/dist/swedish-municipality-DlUS7g7h.d.cts +87 -0
  72. package/dist/swedish-municipality-nDRHYRAd.d.ts +87 -0
  73. package/dist/swedish-organization-name-D7NvERxA.d.cts +33 -0
  74. package/dist/swedish-organization-name-rR0Q836C.d.ts +33 -0
  75. package/dist/swedish-organization-number-Bcj7V_lh.d.cts +130 -0
  76. package/dist/swedish-organization-number-DM8dpXwR.d.ts +130 -0
  77. package/dist/swedish-organization-type-CZOdETwG.d.cts +29 -0
  78. package/dist/swedish-organization-type-CZOdETwG.d.ts +29 -0
  79. package/dist/swedish-personal-identity-number-BiIg4io3.d.ts +149 -0
  80. package/dist/swedish-personal-identity-number-Cp9Coz55.d.cts +149 -0
  81. package/dist/swedish-property-designation-BM-gdd9x.d.ts +46 -0
  82. package/dist/swedish-property-designation-BaHXufqV.d.cts +46 -0
  83. package/dist/swedish-sni-code-Ccsswpni.d.ts +53 -0
  84. package/dist/swedish-sni-code-CuJFyM6l.d.cts +53 -0
  85. package/dist/swedish-swish-number-CL6Gx_h3.d.cts +397 -0
  86. package/dist/swedish-swish-number-DDG3mNDg.d.ts +397 -0
  87. package/dist/text-candidate-qg2bD9PY.d.cts +110 -0
  88. package/dist/text-candidate-qg2bD9PY.d.ts +110 -0
  89. package/dist/text-scanning/index.cjs +10414 -0
  90. package/dist/text-scanning/index.cjs.map +1 -0
  91. package/dist/text-scanning/index.d.cts +153 -0
  92. package/dist/text-scanning/index.d.ts +153 -0
  93. package/dist/text-scanning/index.js +10406 -0
  94. package/dist/text-scanning/index.js.map +1 -0
  95. package/dist/validation/index.cjs +83 -0
  96. package/dist/validation/index.cjs.map +1 -0
  97. package/dist/validation/index.d.cts +63 -0
  98. package/dist/validation/index.d.ts +63 -0
  99. package/dist/validation/index.js +79 -0
  100. package/dist/validation/index.js.map +1 -0
  101. package/dist/web/index.cjs +3994 -0
  102. package/dist/web/index.cjs.map +1 -0
  103. package/dist/web/index.d.cts +203 -0
  104. package/dist/web/index.d.ts +203 -0
  105. package/dist/web/index.js +3987 -0
  106. package/dist/web/index.js.map +1 -0
  107. package/package.json +211 -0
@@ -0,0 +1,83 @@
1
+ import { d as Currency } from '../country-BhD51LDL.cjs';
2
+ export { g as getCurrencyForCountry } from '../country-BhD51LDL.cjs';
3
+ export { I as Isin, m as maskIsin } from '../isin-ZlQLBVm8.cjs';
4
+ import { P as PrimitiveTypeInfo } from '../text-candidate-qg2bD9PY.cjs';
5
+
6
+ /** Provides exchange rates between {@link Currency} pairs. */
7
+ interface IExchangeRates {
8
+ /**
9
+ * Returns the exchange rate from `from` to `to`. Returns `1` when both
10
+ * currencies are the same. Throws when no rate is available.
11
+ */
12
+ getRate(from: Currency, to: Currency): number;
13
+ /**
14
+ * Attempts to read a rate. Returns `null` when no rate is available.
15
+ * Returns `1` when both currencies are the same.
16
+ */
17
+ tryGetRate(from: Currency, to: Currency): number | null;
18
+ }
19
+ /**
20
+ * Dictionary-backed collection of exchange rates. Automatically derives the
21
+ * inverse rate unless an explicit value is added in both directions.
22
+ */
23
+ declare class ExchangeRates implements IExchangeRates {
24
+ #private;
25
+ /**
26
+ * Adds a rate from `from` to `to`. A rate of `0.095` from SEK to USD means
27
+ * `1 SEK = 0.095 USD`. Returns `this` for fluent chaining.
28
+ */
29
+ addRate(from: Currency, to: Currency, rate: number): this;
30
+ getRate(from: Currency, to: Currency): number;
31
+ tryGetRate(from: Currency, to: Currency): number | null;
32
+ }
33
+
34
+ interface ParseOptions {
35
+ fallbackCurrency?: Currency | null;
36
+ }
37
+ interface FormatOptions extends ParseOptions {
38
+ fallbackToTrimmedInputWhenInvalid?: boolean;
39
+ }
40
+ /**
41
+ * A monetary amount composed of a numeric value and a {@link Currency}.
42
+ *
43
+ * Note: JavaScript has no native arbitrary-precision decimal. Amounts are
44
+ * stored as `number` (IEEE-754 double). Parsing and arithmetic round to the
45
+ * currency's decimal places to keep results predictable.
46
+ */
47
+ declare class MoneyAmount {
48
+ static readonly typeInfo: PrimitiveTypeInfo;
49
+ readonly amount: number;
50
+ readonly currency: Currency;
51
+ private constructor();
52
+ /** Creates a {@link MoneyAmount} from an explicit amount and currency. */
53
+ static create(amount: number, currency: Currency): MoneyAmount;
54
+ static tryParse(input: string | null | undefined, options?: ParseOptions): MoneyAmount | null;
55
+ static parse(input: string, options?: ParseOptions): MoneyAmount;
56
+ static isValid(input: string | null | undefined, options?: ParseOptions): boolean;
57
+ /** Returns the amount formatted using the default culture's numeric conventions, e.g. `1 000,00 SEK`. */
58
+ static format(input: string | null | undefined, options?: FormatOptions): string | null;
59
+ /** Returns the amount as a plain decimal string with the ISO code, e.g. `1000.50 SEK`. */
60
+ static normalize(input: string | null | undefined, options?: FormatOptions): string | null;
61
+ static isNormalized(input: string | null | undefined): boolean;
62
+ /** `1000.50 SEK` (invariant culture). */
63
+ toNormalizedString(): string;
64
+ /** `1 000,00 SEK` (current culture). */
65
+ toString(): string;
66
+ add(other: MoneyAmount): MoneyAmount;
67
+ subtract(other: MoneyAmount): MoneyAmount;
68
+ multiply(factor: number): MoneyAmount;
69
+ divide(divisor: number): MoneyAmount;
70
+ negate(): MoneyAmount;
71
+ /**
72
+ * Converts this amount to `target` using either an explicit rate or an
73
+ * {@link IExchangeRates} provider. The result is rounded to the target
74
+ * currency's decimal places using half-up rounding.
75
+ */
76
+ convertTo(target: Currency, rateOrRates: number | IExchangeRates): MoneyAmount;
77
+ equals(other: MoneyAmount | null | undefined): boolean;
78
+ compareTo(other: MoneyAmount | null | undefined): number;
79
+ }
80
+ /** Mask a money amount preserving the currency, e.g. `1 000,00 SEK` → `*** SEK`. */
81
+ declare function maskMoneyAmount(amount: MoneyAmount): string;
82
+
83
+ export { Currency, ExchangeRates, type IExchangeRates, MoneyAmount, maskMoneyAmount };
@@ -0,0 +1,83 @@
1
+ import { d as Currency } from '../country-p0n0EVQ9.js';
2
+ export { g as getCurrencyForCountry } from '../country-p0n0EVQ9.js';
3
+ export { I as Isin, m as maskIsin } from '../isin-EeVPpNWu.js';
4
+ import { P as PrimitiveTypeInfo } from '../text-candidate-qg2bD9PY.js';
5
+
6
+ /** Provides exchange rates between {@link Currency} pairs. */
7
+ interface IExchangeRates {
8
+ /**
9
+ * Returns the exchange rate from `from` to `to`. Returns `1` when both
10
+ * currencies are the same. Throws when no rate is available.
11
+ */
12
+ getRate(from: Currency, to: Currency): number;
13
+ /**
14
+ * Attempts to read a rate. Returns `null` when no rate is available.
15
+ * Returns `1` when both currencies are the same.
16
+ */
17
+ tryGetRate(from: Currency, to: Currency): number | null;
18
+ }
19
+ /**
20
+ * Dictionary-backed collection of exchange rates. Automatically derives the
21
+ * inverse rate unless an explicit value is added in both directions.
22
+ */
23
+ declare class ExchangeRates implements IExchangeRates {
24
+ #private;
25
+ /**
26
+ * Adds a rate from `from` to `to`. A rate of `0.095` from SEK to USD means
27
+ * `1 SEK = 0.095 USD`. Returns `this` for fluent chaining.
28
+ */
29
+ addRate(from: Currency, to: Currency, rate: number): this;
30
+ getRate(from: Currency, to: Currency): number;
31
+ tryGetRate(from: Currency, to: Currency): number | null;
32
+ }
33
+
34
+ interface ParseOptions {
35
+ fallbackCurrency?: Currency | null;
36
+ }
37
+ interface FormatOptions extends ParseOptions {
38
+ fallbackToTrimmedInputWhenInvalid?: boolean;
39
+ }
40
+ /**
41
+ * A monetary amount composed of a numeric value and a {@link Currency}.
42
+ *
43
+ * Note: JavaScript has no native arbitrary-precision decimal. Amounts are
44
+ * stored as `number` (IEEE-754 double). Parsing and arithmetic round to the
45
+ * currency's decimal places to keep results predictable.
46
+ */
47
+ declare class MoneyAmount {
48
+ static readonly typeInfo: PrimitiveTypeInfo;
49
+ readonly amount: number;
50
+ readonly currency: Currency;
51
+ private constructor();
52
+ /** Creates a {@link MoneyAmount} from an explicit amount and currency. */
53
+ static create(amount: number, currency: Currency): MoneyAmount;
54
+ static tryParse(input: string | null | undefined, options?: ParseOptions): MoneyAmount | null;
55
+ static parse(input: string, options?: ParseOptions): MoneyAmount;
56
+ static isValid(input: string | null | undefined, options?: ParseOptions): boolean;
57
+ /** Returns the amount formatted using the default culture's numeric conventions, e.g. `1 000,00 SEK`. */
58
+ static format(input: string | null | undefined, options?: FormatOptions): string | null;
59
+ /** Returns the amount as a plain decimal string with the ISO code, e.g. `1000.50 SEK`. */
60
+ static normalize(input: string | null | undefined, options?: FormatOptions): string | null;
61
+ static isNormalized(input: string | null | undefined): boolean;
62
+ /** `1000.50 SEK` (invariant culture). */
63
+ toNormalizedString(): string;
64
+ /** `1 000,00 SEK` (current culture). */
65
+ toString(): string;
66
+ add(other: MoneyAmount): MoneyAmount;
67
+ subtract(other: MoneyAmount): MoneyAmount;
68
+ multiply(factor: number): MoneyAmount;
69
+ divide(divisor: number): MoneyAmount;
70
+ negate(): MoneyAmount;
71
+ /**
72
+ * Converts this amount to `target` using either an explicit rate or an
73
+ * {@link IExchangeRates} provider. The result is rounded to the target
74
+ * currency's decimal places using half-up rounding.
75
+ */
76
+ convertTo(target: Currency, rateOrRates: number | IExchangeRates): MoneyAmount;
77
+ equals(other: MoneyAmount | null | undefined): boolean;
78
+ compareTo(other: MoneyAmount | null | undefined): number;
79
+ }
80
+ /** Mask a money amount preserving the currency, e.g. `1 000,00 SEK` → `*** SEK`. */
81
+ declare function maskMoneyAmount(amount: MoneyAmount): string;
82
+
83
+ export { Currency, ExchangeRates, type IExchangeRates, MoneyAmount, maskMoneyAmount };