@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.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/banking/index.cjs +6491 -0
- package/dist/banking/index.cjs.map +1 -0
- package/dist/banking/index.d.cts +58 -0
- package/dist/banking/index.d.ts +58 -0
- package/dist/banking/index.js +6464 -0
- package/dist/banking/index.js.map +1 -0
- package/dist/contact/index.cjs +6678 -0
- package/dist/contact/index.cjs.map +1 -0
- package/dist/contact/index.d.cts +709 -0
- package/dist/contact/index.d.ts +709 -0
- package/dist/contact/index.js +6586 -0
- package/dist/contact/index.js.map +1 -0
- package/dist/country-BhD51LDL.d.cts +433 -0
- package/dist/country-p0n0EVQ9.d.ts +433 -0
- package/dist/finance/index.cjs +3592 -0
- package/dist/finance/index.cjs.map +1 -0
- package/dist/finance/index.d.cts +83 -0
- package/dist/finance/index.d.ts +83 -0
- package/dist/finance/index.js +3584 -0
- package/dist/finance/index.js.map +1 -0
- package/dist/geography/index.cjs +4227 -0
- package/dist/geography/index.cjs.map +1 -0
- package/dist/geography/index.d.cts +34 -0
- package/dist/geography/index.d.ts +34 -0
- package/dist/geography/index.js +4202 -0
- package/dist/geography/index.js.map +1 -0
- package/dist/index.cjs +14087 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +13868 -0
- package/dist/index.js.map +1 -0
- package/dist/isin-EeVPpNWu.d.ts +39 -0
- package/dist/isin-ZlQLBVm8.d.cts +39 -0
- package/dist/organization/index.cjs +2376 -0
- package/dist/organization/index.cjs.map +1 -0
- package/dist/organization/index.d.cts +117 -0
- package/dist/organization/index.d.ts +117 -0
- package/dist/organization/index.js +2346 -0
- package/dist/organization/index.js.map +1 -0
- package/dist/person/index.cjs +1144 -0
- package/dist/person/index.cjs.map +1 -0
- package/dist/person/index.d.cts +60 -0
- package/dist/person/index.d.ts +60 -0
- package/dist/person/index.js +1125 -0
- package/dist/person/index.js.map +1 -0
- package/dist/person-full-name-Cmc9Ynuc.d.cts +82 -0
- package/dist/person-full-name-D6Hbsab6.d.ts +82 -0
- package/dist/phone-number-C24--ggy.d.ts +139 -0
- package/dist/phone-number-DZ-YxCQQ.d.cts +139 -0
- package/dist/property/index.cjs +487 -0
- package/dist/property/index.cjs.map +1 -0
- package/dist/property/index.d.cts +56 -0
- package/dist/property/index.d.ts +56 -0
- package/dist/property/index.js +480 -0
- package/dist/property/index.js.map +1 -0
- package/dist/sample-data/index.cjs +12310 -0
- package/dist/sample-data/index.cjs.map +1 -0
- package/dist/sample-data/index.d.cts +260 -0
- package/dist/sample-data/index.d.ts +260 -0
- package/dist/sample-data/index.js +12302 -0
- package/dist/sample-data/index.js.map +1 -0
- package/dist/swedish-address-DNC3ftRF.d.cts +297 -0
- package/dist/swedish-address-GMzjqgxb.d.ts +297 -0
- package/dist/swedish-bank-account-holder-name-BFJ8h1aO.d.cts +45 -0
- package/dist/swedish-bank-account-holder-name-CAAru07F.d.ts +45 -0
- package/dist/swedish-municipality-DlUS7g7h.d.cts +87 -0
- package/dist/swedish-municipality-nDRHYRAd.d.ts +87 -0
- package/dist/swedish-organization-name-D7NvERxA.d.cts +33 -0
- package/dist/swedish-organization-name-rR0Q836C.d.ts +33 -0
- package/dist/swedish-organization-number-Bcj7V_lh.d.cts +130 -0
- package/dist/swedish-organization-number-DM8dpXwR.d.ts +130 -0
- package/dist/swedish-organization-type-CZOdETwG.d.cts +29 -0
- package/dist/swedish-organization-type-CZOdETwG.d.ts +29 -0
- package/dist/swedish-personal-identity-number-BiIg4io3.d.ts +149 -0
- package/dist/swedish-personal-identity-number-Cp9Coz55.d.cts +149 -0
- package/dist/swedish-property-designation-BM-gdd9x.d.ts +46 -0
- package/dist/swedish-property-designation-BaHXufqV.d.cts +46 -0
- package/dist/swedish-sni-code-Ccsswpni.d.ts +53 -0
- package/dist/swedish-sni-code-CuJFyM6l.d.cts +53 -0
- package/dist/swedish-swish-number-CL6Gx_h3.d.cts +397 -0
- package/dist/swedish-swish-number-DDG3mNDg.d.ts +397 -0
- package/dist/text-candidate-qg2bD9PY.d.cts +110 -0
- package/dist/text-candidate-qg2bD9PY.d.ts +110 -0
- package/dist/text-scanning/index.cjs +10414 -0
- package/dist/text-scanning/index.cjs.map +1 -0
- package/dist/text-scanning/index.d.cts +153 -0
- package/dist/text-scanning/index.d.ts +153 -0
- package/dist/text-scanning/index.js +10406 -0
- package/dist/text-scanning/index.js.map +1 -0
- package/dist/validation/index.cjs +83 -0
- package/dist/validation/index.cjs.map +1 -0
- package/dist/validation/index.d.cts +63 -0
- package/dist/validation/index.d.ts +63 -0
- package/dist/validation/index.js +79 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/web/index.cjs +3994 -0
- package/dist/web/index.cjs.map +1 -0
- package/dist/web/index.d.cts +203 -0
- package/dist/web/index.d.ts +203 -0
- package/dist/web/index.js +3987 -0
- package/dist/web/index.js.map +1 -0
- 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 };
|