saudi-utils 0.1.0 → 0.2.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/README.md +8 -5
- package/dist/address.d.ts +77 -0
- package/dist/address.d.ts.map +1 -1
- package/dist/address.js +81 -2
- package/dist/address.js.map +1 -1
- package/dist/banking.d.ts +33 -0
- package/dist/banking.d.ts.map +1 -1
- package/dist/banking.js +36 -1
- package/dist/banking.js.map +1 -1
- package/dist/business.d.ts +56 -0
- package/dist/business.d.ts.map +1 -1
- package/dist/business.js +56 -0
- package/dist/business.js.map +1 -1
- package/dist/combined.d.ts +23 -0
- package/dist/combined.d.ts.map +1 -0
- package/dist/combined.js +81 -0
- package/dist/combined.js.map +1 -0
- package/dist/detailed.d.ts +104 -0
- package/dist/detailed.d.ts.map +1 -0
- package/dist/detailed.js +156 -0
- package/dist/detailed.js.map +1 -0
- package/dist/identity.d.ts +62 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +62 -0
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/telecom.d.ts +54 -2
- package/dist/telecom.d.ts.map +1 -1
- package/dist/telecom.js +74 -26
- package/dist/telecom.js.map +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,13 +45,17 @@ Validators are deliberately strict. They accept `unknown`, but only primitive st
|
|
|
45
45
|
valid identifiers. They do not trim, coerce, remove punctuation, change case, or translate
|
|
46
46
|
Unicode numerals. Canonical numeric values use ASCII digits and preserve leading zeroes.
|
|
47
47
|
|
|
48
|
-
Explicit normalizers accept only their documented variants:
|
|
48
|
+
Every standalone normalizer returns a canonical string directly, or `null` when its documented representation cannot be converted. Normalization does not validate checksums, prefixes, or lengths. Explicit normalizers accept only their documented variants:
|
|
49
49
|
|
|
50
|
-
- `normalizeIban` removes ASCII spaces
|
|
50
|
+
- `normalizeIban` removes ASCII spaces and uppercases ASCII letters.
|
|
51
51
|
- `normalizePhoneNumber` accepts specific unseparated Saudi national and country-code forms.
|
|
52
52
|
- `normalizeShortAddress` uppercases ASCII letters and removes at most one permitted ASCII space.
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Normalizers do not validate domain rules: a canonical candidate may still have an invalid checksum, prefix, or length. They return `null` only when the documented representation cannot produce a meaningful candidate, and are idempotent after success.
|
|
55
|
+
For a single operation with structured errors, use `normalizeAndValidateIban`,
|
|
56
|
+
`normalizeAndValidatePhoneNumber`, or `normalizeAndValidateShortAddress`. Each returns a validated
|
|
57
|
+
canonical value on success, or a code and message on failure. When conversion produced a safe
|
|
58
|
+
candidate, the failure also includes `normalizedValue`. See the [API reference](docs/api.md#normalize-and-validate-together).
|
|
55
59
|
`formatIban` is only a formatter: it accepts a valid, canonical Saudi IBAN and returns `null` for
|
|
56
60
|
lowercase, spaced, invalid, or non-Saudi input. Call `normalizeIban` first when normalization is
|
|
57
61
|
required.
|
|
@@ -169,8 +173,7 @@ validateUnifiedNationalNumber("7123456789").valid; // true: structural result
|
|
|
169
173
|
import { normalizePhoneNumber, validateMobileNumber } from "saudi-utils";
|
|
170
174
|
|
|
171
175
|
validateMobileNumber("0501234567").valid; // true: no reachability or carrier claim
|
|
172
|
-
normalizePhoneNumber("0501234567");
|
|
173
|
-
// { kind: "mobile", value: "+966501234567" }
|
|
176
|
+
normalizePhoneNumber("0501234567"); // "+966501234567"
|
|
174
177
|
```
|
|
175
178
|
|
|
176
179
|
### National Address
|
package/dist/address.d.ts
CHANGED
|
@@ -1,12 +1,89 @@
|
|
|
1
1
|
import type { NationalAddressValidationResult, ValidationResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates a five-digit Saudi National Address postal code.
|
|
4
|
+
*
|
|
5
|
+
* Checks ASCII digit structure only, not allocation or address existence.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
8
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
9
|
+
*/
|
|
2
10
|
export declare function validatePostalCode(value: unknown): ValidationResult;
|
|
11
|
+
/**
|
|
12
|
+
* Checks the five-digit Saudi postal code structure only.
|
|
13
|
+
*
|
|
14
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
15
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
16
|
+
*/
|
|
3
17
|
export declare function isPostalCode(value: unknown): value is string;
|
|
18
|
+
/**
|
|
19
|
+
* Validates a four-digit Saudi National Address building number.
|
|
20
|
+
*
|
|
21
|
+
* Checks ASCII digit structure only, not allocation or address existence.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
24
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
25
|
+
*/
|
|
4
26
|
export declare function validateBuildingNumber(value: unknown): ValidationResult;
|
|
27
|
+
/**
|
|
28
|
+
* Checks the four-digit Saudi building number structure only.
|
|
29
|
+
*
|
|
30
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
31
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
32
|
+
*/
|
|
5
33
|
export declare function isBuildingNumber(value: unknown): value is string;
|
|
34
|
+
/**
|
|
35
|
+
* Validates a four-digit Saudi National Address additional number.
|
|
36
|
+
*
|
|
37
|
+
* Checks ASCII digit structure only, not allocation or address existence.
|
|
38
|
+
*
|
|
39
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
40
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
41
|
+
*/
|
|
6
42
|
export declare function validateAdditionalNumber(value: unknown): ValidationResult;
|
|
43
|
+
/**
|
|
44
|
+
* Checks the four-digit Saudi additional number structure only.
|
|
45
|
+
*
|
|
46
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
47
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
48
|
+
*/
|
|
7
49
|
export declare function isAdditionalNumber(value: unknown): value is string;
|
|
50
|
+
/**
|
|
51
|
+
* Validates a canonical Saudi Short Address: four uppercase ASCII letters followed by four ASCII digits.
|
|
52
|
+
*
|
|
53
|
+
* Spaces and lowercase letters are not accepted here; use normalizeShortAddress explicitly.
|
|
54
|
+
*
|
|
55
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
56
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
57
|
+
*/
|
|
8
58
|
export declare function validateShortAddress(value: unknown): ValidationResult;
|
|
59
|
+
/**
|
|
60
|
+
* Checks the canonical eight-character Saudi Short Address structure.
|
|
61
|
+
*
|
|
62
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
63
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
64
|
+
*/
|
|
9
65
|
export declare function isShortAddress(value: unknown): value is string;
|
|
66
|
+
/**
|
|
67
|
+
* Converts a supported Short Address representation to canonical form without validating it.
|
|
68
|
+
*
|
|
69
|
+
* Uppercases ASCII letters and removes at most one ASCII space between the groups; rejects other separators and Unicode characters.
|
|
70
|
+
*
|
|
71
|
+
* @param value - Unknown input; only a primitive string is accepted.
|
|
72
|
+
* @returns Four uppercase ASCII letters followed by the supplied ASCII digits, even when the digit count is invalid; null when the representation is unsupported.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* normalizeShortAddress("abcd 1234"); // "ABCD1234"
|
|
76
|
+
*/
|
|
10
77
|
export declare function normalizeShortAddress(value: unknown): string | null;
|
|
78
|
+
/** @internal Produces a candidate without claiming that the Short Address is valid. */
|
|
79
|
+
export declare function normalizeShortAddressInput(value: unknown): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Validates the required shape and component formats of a Saudi National Address object.
|
|
82
|
+
*
|
|
83
|
+
* All fields must be nonempty strings. Building and additional numbers must have four ASCII digits; postal code must have five. Street, district, and city have no further format check. Existence and field relationships are not verified.
|
|
84
|
+
*
|
|
85
|
+
* @param value - Unknown input; must be an object with own data properties for buildingNumber, street, district, city, postalCode, and additionalNumber.
|
|
86
|
+
* @returns The copied address fields when valid, or the first applicable error code.
|
|
87
|
+
*/
|
|
11
88
|
export declare function validateNationalAddress(value: unknown): NationalAddressValidationResult;
|
|
12
89
|
//# sourceMappingURL=address.d.ts.map
|
package/dist/address.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA6BpF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEnE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE5D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEvE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEzE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAElE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAgBrE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA6BpF;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEvE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAElE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAgBrE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAEnE;AAED,uFAAuF;AACvF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAUxE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,+BAA+B,CA8DvF"}
|
package/dist/address.js
CHANGED
|
@@ -21,24 +21,74 @@ function validateFixedLengthDigits(value, length) {
|
|
|
21
21
|
}
|
|
22
22
|
return { valid: true, value: input.value };
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Validates a five-digit Saudi National Address postal code.
|
|
26
|
+
*
|
|
27
|
+
* Checks ASCII digit structure only, not allocation or address existence.
|
|
28
|
+
*
|
|
29
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
30
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
31
|
+
*/
|
|
24
32
|
export function validatePostalCode(value) {
|
|
25
33
|
return validateFixedLengthDigits(value, 5);
|
|
26
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Checks the five-digit Saudi postal code structure only.
|
|
37
|
+
*
|
|
38
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
39
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
40
|
+
*/
|
|
27
41
|
export function isPostalCode(value) {
|
|
28
42
|
return validatePostalCode(value).valid;
|
|
29
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Validates a four-digit Saudi National Address building number.
|
|
46
|
+
*
|
|
47
|
+
* Checks ASCII digit structure only, not allocation or address existence.
|
|
48
|
+
*
|
|
49
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
50
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
51
|
+
*/
|
|
30
52
|
export function validateBuildingNumber(value) {
|
|
31
53
|
return validateFixedLengthDigits(value, 4);
|
|
32
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Checks the four-digit Saudi building number structure only.
|
|
57
|
+
*
|
|
58
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
59
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
60
|
+
*/
|
|
33
61
|
export function isBuildingNumber(value) {
|
|
34
62
|
return validateBuildingNumber(value).valid;
|
|
35
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Validates a four-digit Saudi National Address additional number.
|
|
66
|
+
*
|
|
67
|
+
* Checks ASCII digit structure only, not allocation or address existence.
|
|
68
|
+
*
|
|
69
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
70
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
71
|
+
*/
|
|
36
72
|
export function validateAdditionalNumber(value) {
|
|
37
73
|
return validateFixedLengthDigits(value, 4);
|
|
38
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Checks the four-digit Saudi additional number structure only.
|
|
77
|
+
*
|
|
78
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
79
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
80
|
+
*/
|
|
39
81
|
export function isAdditionalNumber(value) {
|
|
40
82
|
return validateAdditionalNumber(value).valid;
|
|
41
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Validates a canonical Saudi Short Address: four uppercase ASCII letters followed by four ASCII digits.
|
|
86
|
+
*
|
|
87
|
+
* Spaces and lowercase letters are not accepted here; use normalizeShortAddress explicitly.
|
|
88
|
+
*
|
|
89
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
90
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
91
|
+
*/
|
|
42
92
|
export function validateShortAddress(value) {
|
|
43
93
|
const input = checkStringInput(value);
|
|
44
94
|
if (!input.valid) {
|
|
@@ -52,18 +102,47 @@ export function validateShortAddress(value) {
|
|
|
52
102
|
}
|
|
53
103
|
return { valid: true, value: input.value };
|
|
54
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Checks the canonical eight-character Saudi Short Address structure.
|
|
107
|
+
*
|
|
108
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
109
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
110
|
+
*/
|
|
55
111
|
export function isShortAddress(value) {
|
|
56
112
|
return validateShortAddress(value).valid;
|
|
57
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Converts a supported Short Address representation to canonical form without validating it.
|
|
116
|
+
*
|
|
117
|
+
* Uppercases ASCII letters and removes at most one ASCII space between the groups; rejects other separators and Unicode characters.
|
|
118
|
+
*
|
|
119
|
+
* @param value - Unknown input; only a primitive string is accepted.
|
|
120
|
+
* @returns Four uppercase ASCII letters followed by the supplied ASCII digits, even when the digit count is invalid; null when the representation is unsupported.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* normalizeShortAddress("abcd 1234"); // "ABCD1234"
|
|
124
|
+
*/
|
|
58
125
|
export function normalizeShortAddress(value) {
|
|
126
|
+
return normalizeShortAddressInput(value);
|
|
127
|
+
}
|
|
128
|
+
/** @internal Produces a candidate without claiming that the Short Address is valid. */
|
|
129
|
+
export function normalizeShortAddressInput(value) {
|
|
59
130
|
if (typeof value !== "string") {
|
|
60
131
|
return null;
|
|
61
132
|
}
|
|
62
|
-
if (!/^[A-Za-z]{4} ?[0-9]
|
|
133
|
+
if (!/^[A-Za-z]{4} ?[0-9]*$/.test(value)) {
|
|
63
134
|
return null;
|
|
64
135
|
}
|
|
65
|
-
return `${value.slice(0, 4).toUpperCase()}${value.slice(
|
|
136
|
+
return `${value.slice(0, 4).toUpperCase()}${value.slice(value[4] === " " ? 5 : 4)}`;
|
|
66
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Validates the required shape and component formats of a Saudi National Address object.
|
|
140
|
+
*
|
|
141
|
+
* All fields must be nonempty strings. Building and additional numbers must have four ASCII digits; postal code must have five. Street, district, and city have no further format check. Existence and field relationships are not verified.
|
|
142
|
+
*
|
|
143
|
+
* @param value - Unknown input; must be an object with own data properties for buildingNumber, street, district, city, postalCode, and additionalNumber.
|
|
144
|
+
* @returns The copied address fields when valid, or the first applicable error code.
|
|
145
|
+
*/
|
|
67
146
|
export function validateNationalAddress(value) {
|
|
68
147
|
if (value === undefined || value === null || value === "") {
|
|
69
148
|
return { valid: false, code: "REQUIRED" };
|
package/dist/address.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,E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,MAAM,CAAC,QAAQ,CAAC;IACjC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACrC,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAEjD,IACE,OAAO,cAAc,KAAK,QAAQ;QAClC,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,QAAQ,KAAK,QAAQ;QAC5B,OAAO,IAAI,KAAK,QAAQ;QACxB,OAAO,UAAU,KAAK,QAAQ;QAC9B,OAAO,gBAAgB,KAAK,QAAQ,EACpC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,gBAAgB,GAAG;QACvB,sBAAsB,CAAC,cAAc,CAAC;QACtC,kBAAkB,CAAC,UAAU,CAAC;QAC9B,wBAAwB,CAAC,gBAAgB,CAAC;KAC3C,CAAC;IAEF,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,IAAI;QACX,KAAK,EAAE;YACL,cAAc;YACd,MAAM;YACN,QAAQ;YACR,IAAI;YACJ,UAAU;YACV,gBAAgB;SACjB;KACF,CAAC;AACJ,CAAC"}
|
package/dist/banking.d.ts
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import type { ValidationResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates a canonical Saudi IBAN: 24 uppercase ASCII characters, SA country code, numeric check/bank digits, and MOD-97 checksum.
|
|
4
|
+
*
|
|
5
|
+
* Spaces and lowercase letters are not accepted here; use normalizeIban explicitly.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
8
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
9
|
+
*/
|
|
2
10
|
export declare function validateSaudiIban(value: unknown): ValidationResult;
|
|
11
|
+
/**
|
|
12
|
+
* Checks the canonical Saudi IBAN structure and MOD-97 checksum.
|
|
13
|
+
*
|
|
14
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
15
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
16
|
+
*/
|
|
3
17
|
export declare function isSaudiIban(value: unknown): value is string;
|
|
18
|
+
/**
|
|
19
|
+
* Converts an IBAN representation to canonical ASCII form without validating it.
|
|
20
|
+
*
|
|
21
|
+
* Removes ASCII spaces and uppercases ASCII letters. Other separators and Unicode digits are rejected.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Unknown input; only a primitive string is accepted.
|
|
24
|
+
* @returns The uppercase, unspaced candidate, even if its length, country code, or checksum is invalid; null when no candidate can be produced.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* normalizeIban("sa39 1500 0000 1234 5678 9012"); // "SA3915000000123456789012"
|
|
28
|
+
*/
|
|
4
29
|
export declare function normalizeIban(value: unknown): string | null;
|
|
30
|
+
/** @internal Produces a candidate without claiming that the IBAN is valid. */
|
|
31
|
+
export declare function normalizeIbanInput(value: unknown): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Groups a valid canonical Saudi IBAN into six blocks of four characters.
|
|
34
|
+
*
|
|
35
|
+
* @param value - Unknown input; must be a valid, uppercase, unspaced Saudi IBAN string.
|
|
36
|
+
* @returns The grouped IBAN with ASCII spaces, or null for invalid input.
|
|
37
|
+
*/
|
|
5
38
|
export declare function formatIban(value: unknown): string | null;
|
|
6
39
|
//# sourceMappingURL=banking.d.ts.map
|
package/dist/banking.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banking.d.ts","sourceRoot":"","sources":["../src/banking.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgBnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CA4BlE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"banking.d.ts","sourceRoot":"","sources":["../src/banking.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgBnD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CA4BlE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAwBhE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAMxD"}
|
package/dist/banking.js
CHANGED
|
@@ -11,6 +11,14 @@ function hasValidIbanChecksum(value) {
|
|
|
11
11
|
}
|
|
12
12
|
return mod97(expanded) === 1;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Validates a canonical Saudi IBAN: 24 uppercase ASCII characters, SA country code, numeric check/bank digits, and MOD-97 checksum.
|
|
16
|
+
*
|
|
17
|
+
* Spaces and lowercase letters are not accepted here; use normalizeIban explicitly.
|
|
18
|
+
*
|
|
19
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
20
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
21
|
+
*/
|
|
14
22
|
export function validateSaudiIban(value) {
|
|
15
23
|
const input = checkStringInput(value);
|
|
16
24
|
if (!input.valid) {
|
|
@@ -32,10 +40,31 @@ export function validateSaudiIban(value) {
|
|
|
32
40
|
}
|
|
33
41
|
return { valid: true, value: input.value };
|
|
34
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks the canonical Saudi IBAN structure and MOD-97 checksum.
|
|
45
|
+
*
|
|
46
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
47
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
48
|
+
*/
|
|
35
49
|
export function isSaudiIban(value) {
|
|
36
50
|
return validateSaudiIban(value).valid;
|
|
37
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Converts an IBAN representation to canonical ASCII form without validating it.
|
|
54
|
+
*
|
|
55
|
+
* Removes ASCII spaces and uppercases ASCII letters. Other separators and Unicode digits are rejected.
|
|
56
|
+
*
|
|
57
|
+
* @param value - Unknown input; only a primitive string is accepted.
|
|
58
|
+
* @returns The uppercase, unspaced candidate, even if its length, country code, or checksum is invalid; null when no candidate can be produced.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* normalizeIban("sa39 1500 0000 1234 5678 9012"); // "SA3915000000123456789012"
|
|
62
|
+
*/
|
|
38
63
|
export function normalizeIban(value) {
|
|
64
|
+
return normalizeIbanInput(value);
|
|
65
|
+
}
|
|
66
|
+
/** @internal Produces a candidate without claiming that the IBAN is valid. */
|
|
67
|
+
export function normalizeIbanInput(value) {
|
|
39
68
|
if (typeof value !== "string") {
|
|
40
69
|
return null;
|
|
41
70
|
}
|
|
@@ -55,8 +84,14 @@ export function normalizeIban(value) {
|
|
|
55
84
|
return null;
|
|
56
85
|
}
|
|
57
86
|
}
|
|
58
|
-
return
|
|
87
|
+
return normalized === "" ? null : normalized;
|
|
59
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Groups a valid canonical Saudi IBAN into six blocks of four characters.
|
|
91
|
+
*
|
|
92
|
+
* @param value - Unknown input; must be a valid, uppercase, unspaced Saudi IBAN string.
|
|
93
|
+
* @returns The grouped IBAN with ASCII spaces, or null for invalid input.
|
|
94
|
+
*/
|
|
60
95
|
export function formatIban(value) {
|
|
61
96
|
if (!isSaudiIban(value)) {
|
|
62
97
|
return null;
|
package/dist/banking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banking.js","sourceRoot":"","sources":["../src/banking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAE7C,SAAS,oBAAoB,CAAC,KAAa;IACzC,MAAM,UAAU,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC3D,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACrC,QAAQ,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,CAAC;IAED,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEtC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC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AAC;IACd,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AAChJ,CAAC"}
|
package/dist/business.d.ts
CHANGED
|
@@ -1,10 +1,66 @@
|
|
|
1
1
|
import type { ValidationResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates the 15-digit Saudi VAT number structure, including leading and trailing 3.
|
|
4
|
+
*
|
|
5
|
+
* This is structural only; no checksum or registration status is verified.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
8
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
9
|
+
*/
|
|
2
10
|
export declare function validateVatNumber(value: unknown): ValidationResult;
|
|
11
|
+
/**
|
|
12
|
+
* Checks the structural Saudi VAT number format without verifying registration.
|
|
13
|
+
*
|
|
14
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
15
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
16
|
+
*/
|
|
3
17
|
export declare function isVatNumber(value: unknown): value is string;
|
|
18
|
+
/**
|
|
19
|
+
* Validates the best-known ZATCA TIN structure: exactly 10 ASCII digits.
|
|
20
|
+
*
|
|
21
|
+
* No checksum or tax registration status is verified.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
24
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
25
|
+
*/
|
|
4
26
|
export declare function validateTin(value: unknown): ValidationResult;
|
|
27
|
+
/**
|
|
28
|
+
* Checks the 10-digit ZATCA TIN structure without verifying registration.
|
|
29
|
+
*
|
|
30
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
31
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
32
|
+
*/
|
|
5
33
|
export declare function isTin(value: unknown): value is string;
|
|
34
|
+
/**
|
|
35
|
+
* Validates a non-governmental establishment Unified National Number: 10 ASCII digits starting with 7.
|
|
36
|
+
*
|
|
37
|
+
* No checksum, existence, or registration status is verified.
|
|
38
|
+
*
|
|
39
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
40
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
41
|
+
*/
|
|
6
42
|
export declare function validateUnifiedNationalNumber(value: unknown): ValidationResult;
|
|
43
|
+
/**
|
|
44
|
+
* Checks the Unified National Number structure without verifying the establishment.
|
|
45
|
+
*
|
|
46
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
47
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
48
|
+
*/
|
|
7
49
|
export declare function isUnifiedNationalNumber(value: unknown): value is string;
|
|
50
|
+
/**
|
|
51
|
+
* Validates the legacy Commercial Registration structure: exactly 10 ASCII digits.
|
|
52
|
+
*
|
|
53
|
+
* This does not validate a current Unified National Number or confirm registration.
|
|
54
|
+
*
|
|
55
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
56
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
57
|
+
*/
|
|
8
58
|
export declare function validateCommercialRegistration(value: unknown): ValidationResult;
|
|
59
|
+
/**
|
|
60
|
+
* Checks the legacy 10-digit Commercial Registration structure only.
|
|
61
|
+
*
|
|
62
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
63
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
64
|
+
*/
|
|
9
65
|
export declare function isCommercialRegistration(value: unknown): value is string;
|
|
10
66
|
//# sourceMappingURL=business.d.ts.map
|
package/dist/business.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../src/business.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAoBlE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAgB5D;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAErD;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAoB9E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEvE;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAgB/E;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExE"}
|
|
1
|
+
{"version":3,"file":"business.d.ts","sourceRoot":"","sources":["../src/business.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAoBlE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAgB5D;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAoB9E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEvE;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAgB/E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExE"}
|
package/dist/business.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { isAsciiDigits } from "./internal/ascii.js";
|
|
2
2
|
import { checkStringInput } from "./internal/input.js";
|
|
3
|
+
/**
|
|
4
|
+
* Validates the 15-digit Saudi VAT number structure, including leading and trailing 3.
|
|
5
|
+
*
|
|
6
|
+
* This is structural only; no checksum or registration status is verified.
|
|
7
|
+
*
|
|
8
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
9
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
10
|
+
*/
|
|
3
11
|
export function validateVatNumber(value) {
|
|
4
12
|
const input = checkStringInput(value);
|
|
5
13
|
if (!input.valid) {
|
|
@@ -16,9 +24,23 @@ export function validateVatNumber(value) {
|
|
|
16
24
|
}
|
|
17
25
|
return { valid: true, value: input.value };
|
|
18
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Checks the structural Saudi VAT number format without verifying registration.
|
|
29
|
+
*
|
|
30
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
31
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
32
|
+
*/
|
|
19
33
|
export function isVatNumber(value) {
|
|
20
34
|
return validateVatNumber(value).valid;
|
|
21
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Validates the best-known ZATCA TIN structure: exactly 10 ASCII digits.
|
|
38
|
+
*
|
|
39
|
+
* No checksum or tax registration status is verified.
|
|
40
|
+
*
|
|
41
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
42
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
43
|
+
*/
|
|
22
44
|
export function validateTin(value) {
|
|
23
45
|
const input = checkStringInput(value);
|
|
24
46
|
if (!input.valid) {
|
|
@@ -32,9 +54,23 @@ export function validateTin(value) {
|
|
|
32
54
|
}
|
|
33
55
|
return { valid: true, value: input.value };
|
|
34
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Checks the 10-digit ZATCA TIN structure without verifying registration.
|
|
59
|
+
*
|
|
60
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
61
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
62
|
+
*/
|
|
35
63
|
export function isTin(value) {
|
|
36
64
|
return validateTin(value).valid;
|
|
37
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Validates a non-governmental establishment Unified National Number: 10 ASCII digits starting with 7.
|
|
68
|
+
*
|
|
69
|
+
* No checksum, existence, or registration status is verified.
|
|
70
|
+
*
|
|
71
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
72
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
73
|
+
*/
|
|
38
74
|
export function validateUnifiedNationalNumber(value) {
|
|
39
75
|
const input = checkStringInput(value);
|
|
40
76
|
if (!input.valid) {
|
|
@@ -51,9 +87,23 @@ export function validateUnifiedNationalNumber(value) {
|
|
|
51
87
|
}
|
|
52
88
|
return { valid: true, value: input.value };
|
|
53
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks the Unified National Number structure without verifying the establishment.
|
|
92
|
+
*
|
|
93
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
94
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
95
|
+
*/
|
|
54
96
|
export function isUnifiedNationalNumber(value) {
|
|
55
97
|
return validateUnifiedNationalNumber(value).valid;
|
|
56
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Validates the legacy Commercial Registration structure: exactly 10 ASCII digits.
|
|
101
|
+
*
|
|
102
|
+
* This does not validate a current Unified National Number or confirm registration.
|
|
103
|
+
*
|
|
104
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
105
|
+
* @returns A result containing the unchanged string when valid, or the first applicable error code.
|
|
106
|
+
*/
|
|
57
107
|
export function validateCommercialRegistration(value) {
|
|
58
108
|
const input = checkStringInput(value);
|
|
59
109
|
if (!input.valid) {
|
|
@@ -67,6 +117,12 @@ export function validateCommercialRegistration(value) {
|
|
|
67
117
|
}
|
|
68
118
|
return { valid: true, value: input.value };
|
|
69
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Checks the legacy 10-digit Commercial Registration structure only.
|
|
122
|
+
*
|
|
123
|
+
* @param value - Unknown input; only a primitive string in the stated canonical format is accepted.
|
|
124
|
+
* @returns True when the input satisfies the stated offline rules; false otherwise.
|
|
125
|
+
*/
|
|
70
126
|
export function isCommercialRegistration(value) {
|
|
71
127
|
return validateCommercialRegistration(value).valid;
|
|
72
128
|
}
|
package/dist/business.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business.js","sourceRoot":"","sources":["../src/business.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEtC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAA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,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,8BAA8B,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DetailedValidationResult, NormalizedSaudiPhone } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes and validates a Saudi IBAN using the same rules as normalizeIban and validateSaudiIbanDetailed.
|
|
4
|
+
* @param value - Primitive string; ASCII spaces are removed and ASCII letters are uppercased.
|
|
5
|
+
* @returns The validated uppercase IBAN, or a code and message. A safe candidate is included on validation failure.
|
|
6
|
+
* @example
|
|
7
|
+
* normalizeAndValidateIban("sa03 8000 0000 6080 1016 7519"); // { valid: true, value: "SA0380000000608010167519" }
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeAndValidateIban(value: unknown): DetailedValidationResult<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes and validates a Saudi Short Address using the same rules as normalizeShortAddress and validateShortAddressDetailed.
|
|
12
|
+
* @param value - Primitive string with four ASCII letters, optional one ASCII space, then ASCII digits.
|
|
13
|
+
* @returns The validated uppercase eight-character address, or a code and message with a safe candidate when available.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeAndValidateShortAddress(value: unknown): DetailedValidationResult<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Normalizes and validates a Saudi mobile, landline, or toll-free number.
|
|
18
|
+
* @param value - Primitive string in a supported unseparated national or country-code form.
|
|
19
|
+
* @returns A kind-tagged canonical phone value, or a code and message with a safe candidate when available.
|
|
20
|
+
* Mobile and landline values use +966 form; toll-free values use national 800 form.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeAndValidatePhoneNumber(value: unknown): DetailedValidationResult<NormalizedSaudiPhone>;
|
|
23
|
+
//# sourceMappingURL=combined.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combined.d.ts","sourceRoot":"","sources":["../src/combined.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAiCpB;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAKzF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAKjG;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,GACb,wBAAwB,CAAC,oBAAoB,CAAC,CAyBhD"}
|