@validex/core 1.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.
- package/LICENSE +21 -0
- package/README.md +583 -0
- package/dist/checks/index.cjs +51 -0
- package/dist/checks/index.d.cts +207 -0
- package/dist/checks/index.d.ts +207 -0
- package/dist/checks/index.js +51 -0
- package/dist/chunk-2OTGUKO7.cjs +26 -0
- package/dist/chunk-4HUGF4EZ.js +0 -0
- package/dist/chunk-5CYBSNNG.cjs +33 -0
- package/dist/chunk-5DOFRLSB.js +30 -0
- package/dist/chunk-64X6D23X.cjs +24 -0
- package/dist/chunk-6MGS4JWP.js +152 -0
- package/dist/chunk-AGJWIOFF.js +24 -0
- package/dist/chunk-BAFEYOPS.js +43 -0
- package/dist/chunk-BYMZTDYD.js +56 -0
- package/dist/chunk-D232V332.cjs +30 -0
- package/dist/chunk-FD77PZXB.js +9 -0
- package/dist/chunk-H3XHQLZF.cjs +43 -0
- package/dist/chunk-ISY3F7TI.cjs +239 -0
- package/dist/chunk-JEKRBIPN.cjs +1 -0
- package/dist/chunk-KTN4NQQL.js +33 -0
- package/dist/chunk-LSQNDPFQ.cjs +9 -0
- package/dist/chunk-NDLUDRZJ.js +24 -0
- package/dist/chunk-OCTLUBGT.cjs +24 -0
- package/dist/chunk-OFT3FQPJ.cjs +152 -0
- package/dist/chunk-OOFMB7K5.js +34 -0
- package/dist/chunk-OTPQTLPM.js +50 -0
- package/dist/chunk-P3FRVJ3U.cjs +50 -0
- package/dist/chunk-PFPNNQGJ.js +30 -0
- package/dist/chunk-PQ4TUE2Q.cjs +2688 -0
- package/dist/chunk-SMDC2EAD.js +26 -0
- package/dist/chunk-TB6J73U7.js +239 -0
- package/dist/chunk-TBVAKZA5.js +2688 -0
- package/dist/chunk-TSPTIW3V.cjs +34 -0
- package/dist/chunk-WE2OD5XD.cjs +30 -0
- package/dist/chunk-WKVMDEA3.js +26 -0
- package/dist/chunk-ZAUX2RGL.cjs +56 -0
- package/dist/chunk-ZWIO2MJX.cjs +26 -0
- package/dist/cli/index.cjs +120 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +120 -0
- package/dist/commonPasswords-3BYUBARZ.cjs +10 -0
- package/dist/commonPasswords-ZYOEI6PG.js +10 -0
- package/dist/countryCodes-EKJKVHR5.cjs +10 -0
- package/dist/countryCodes-RTJZVCLB.js +10 -0
- package/dist/countryCodes-VY56VZPT.cjs +255 -0
- package/dist/countryCodes-YRY75MQP.js +255 -0
- package/dist/creditCardPrefixes-EXMJZGE7.cjs +10 -0
- package/dist/creditCardPrefixes-EZK7T4IZ.js +10 -0
- package/dist/creditCardPrefixes-HKWKCHNU.cjs +48 -0
- package/dist/creditCardPrefixes-QP3S4ZAU.js +48 -0
- package/dist/currencyCodes-GU6W3HSN.cjs +171 -0
- package/dist/currencyCodes-P67AASLW.js +171 -0
- package/dist/currencyCodes-RMRLGDME.cjs +10 -0
- package/dist/currencyCodes-U6TSAWDR.js +10 -0
- package/dist/disposableDomains-DCXSV422.js +10 -0
- package/dist/disposableDomains-USU2JQSF.cjs +10 -0
- package/dist/ibanPatterns-2PM32RIY.cjs +85 -0
- package/dist/ibanPatterns-BSQUWKLY.js +85 -0
- package/dist/ibanPatterns-KTLY6TZY.cjs +10 -0
- package/dist/ibanPatterns-LJRPR7FV.js +10 -0
- package/dist/index-Cid7Ygr_.d.cts +950 -0
- package/dist/index-Cid7Ygr_.d.ts +950 -0
- package/dist/index.cjs +361 -0
- package/dist/index.d.cts +132 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.js +361 -0
- package/dist/locales/en.cjs +10 -0
- package/dist/locales/en.d.cts +234 -0
- package/dist/locales/en.d.ts +234 -0
- package/dist/locales/en.js +10 -0
- package/dist/passwordsTier1-NAZLSHKW.cjs +105 -0
- package/dist/passwordsTier1-OYRMLOWD.js +105 -0
- package/dist/passwordsTier2-GYJTYGY6.cjs +906 -0
- package/dist/passwordsTier2-JAEO5AYY.js +906 -0
- package/dist/passwordsTier3-BAPUFHZM.cjs +9006 -0
- package/dist/passwordsTier3-E6WBK5OB.js +9006 -0
- package/dist/phoneDetection-AFSSD4IB.cjs +6 -0
- package/dist/phoneDetection-G23LZ6MU.js +6 -0
- package/dist/phoneParser-2RTXDB6H.js +10 -0
- package/dist/phoneParser-CGRP2OUN.cjs +10 -0
- package/dist/postalCodes-4EZVDT2N.cjs +10 -0
- package/dist/postalCodes-ZPAJB3P5.js +10 -0
- package/dist/reservedUsernames-3QPPKUXR.cjs +246 -0
- package/dist/reservedUsernames-GIK6NX3J.js +246 -0
- package/dist/reservedUsernames-QR4ONXSL.js +10 -0
- package/dist/reservedUsernames-W65FGT6A.cjs +10 -0
- package/dist/rules/index.cjs +66 -0
- package/dist/rules/index.d.cts +2 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.js +66 -0
- package/dist/utilities/index.cjs +8 -0
- package/dist/utilities/index.d.cts +47 -0
- package/dist/utilities/index.d.ts +47 -0
- package/dist/utilities/index.js +8 -0
- package/dist/vatPatterns-BLRXHNCP.js +36 -0
- package/dist/vatPatterns-DNVZJPTW.js +10 -0
- package/dist/vatPatterns-NPN6SV2Y.cjs +36 -0
- package/dist/vatPatterns-RRHUTA3U.cjs +10 -0
- package/package.json +133 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Has Uppercase
|
|
3
|
+
* Checks that the string contains uppercase letters within the given bounds.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The string to inspect.
|
|
6
|
+
* @param min - Minimum number of uppercase letters required.
|
|
7
|
+
* @param max - Maximum number of uppercase letters allowed (optional).
|
|
8
|
+
* @returns True if the uppercase letter count is within [min, max].
|
|
9
|
+
*/
|
|
10
|
+
declare function hasUppercase(value: string, min: number, max?: number): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Has Lowercase
|
|
13
|
+
* Checks that the string contains lowercase letters within the given bounds.
|
|
14
|
+
*
|
|
15
|
+
* @param value - The string to inspect.
|
|
16
|
+
* @param min - Minimum number of lowercase letters required.
|
|
17
|
+
* @param max - Maximum number of lowercase letters allowed (optional).
|
|
18
|
+
* @returns True if the lowercase letter count is within [min, max].
|
|
19
|
+
*/
|
|
20
|
+
declare function hasLowercase(value: string, min: number, max?: number): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Has Digits
|
|
23
|
+
* Checks that the string contains digit characters within the given bounds.
|
|
24
|
+
*
|
|
25
|
+
* @param value - The string to inspect.
|
|
26
|
+
* @param min - Minimum number of digits required.
|
|
27
|
+
* @param max - Maximum number of digits allowed (optional).
|
|
28
|
+
* @returns True if the digit count is within [min, max].
|
|
29
|
+
*/
|
|
30
|
+
declare function hasDigits(value: string, min: number, max?: number): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Has Special
|
|
33
|
+
* Checks that the string contains special characters within the given bounds.
|
|
34
|
+
* Special characters are those that are not letters, digits, or whitespace.
|
|
35
|
+
*
|
|
36
|
+
* @param value - The string to inspect.
|
|
37
|
+
* @param min - Minimum number of special characters required.
|
|
38
|
+
* @param max - Maximum number of special characters allowed (optional).
|
|
39
|
+
* @returns True if the special character count is within [min, max].
|
|
40
|
+
*/
|
|
41
|
+
declare function hasSpecial(value: string, min: number, max?: number): boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Contains Email
|
|
45
|
+
* Returns true when the value contains what looks like an email address.
|
|
46
|
+
*
|
|
47
|
+
* @param value - The string to scan for email addresses.
|
|
48
|
+
* @returns True if an email-like pattern is detected.
|
|
49
|
+
*
|
|
50
|
+
* NOTE: Optimised for recall over precision — false positives are acceptable.
|
|
51
|
+
*/
|
|
52
|
+
declare function containsEmail(value: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Contains URL
|
|
55
|
+
* Returns true when the value contains what looks like a URL.
|
|
56
|
+
*
|
|
57
|
+
* @param value - The string to scan for URLs.
|
|
58
|
+
* @returns True if a URL-like pattern is detected.
|
|
59
|
+
*
|
|
60
|
+
* NOTE: Detects both protocol-prefixed (http/https) and www-prefixed URLs.
|
|
61
|
+
*/
|
|
62
|
+
declare function containsUrl(value: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Contains HTML
|
|
65
|
+
* Returns true when the value contains HTML-like tags.
|
|
66
|
+
*
|
|
67
|
+
* @param value - The string to scan for HTML tags.
|
|
68
|
+
* @returns True if an HTML tag pattern is detected.
|
|
69
|
+
*
|
|
70
|
+
* NOTE: Avoids false positives on comparison operators and emoticons.
|
|
71
|
+
*/
|
|
72
|
+
declare function containsHtml(value: string): boolean;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Max Words
|
|
76
|
+
* Returns true if value has at most `max` words.
|
|
77
|
+
*
|
|
78
|
+
* @param value - The string to inspect.
|
|
79
|
+
* @param max - Maximum number of words allowed (inclusive).
|
|
80
|
+
* @returns True if the word count is at most `max`.
|
|
81
|
+
*/
|
|
82
|
+
declare function maxWords(value: string, max: number): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Min Words
|
|
85
|
+
* Returns true if value has at least `min` words.
|
|
86
|
+
*
|
|
87
|
+
* @param value - The string to inspect.
|
|
88
|
+
* @param min - Minimum number of words required (inclusive).
|
|
89
|
+
* @returns True if the word count is at least `min`.
|
|
90
|
+
*/
|
|
91
|
+
declare function minWords(value: string, min: number): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Max Consecutive
|
|
94
|
+
* Returns true if no single character repeats more than `max` times
|
|
95
|
+
* consecutively. Handles unicode characters (emoji, CJK, etc.).
|
|
96
|
+
*
|
|
97
|
+
* @param value - The string to inspect.
|
|
98
|
+
* @param max - Maximum allowed consecutive repetitions (inclusive).
|
|
99
|
+
* @returns True if no character appears more than `max` times in a row.
|
|
100
|
+
*/
|
|
101
|
+
declare function maxConsecutive(value: string, max: number): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* No Spaces
|
|
104
|
+
* Returns true if value contains no whitespace characters.
|
|
105
|
+
*
|
|
106
|
+
* @param value - The string to inspect.
|
|
107
|
+
* @returns True if the string has no spaces, tabs, or newlines.
|
|
108
|
+
*/
|
|
109
|
+
declare function noSpaces(value: string): boolean;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Contains Phone Number
|
|
113
|
+
* Returns true when the value contains a phone number, detected via
|
|
114
|
+
* libphonenumber-js. Uses dynamic import to avoid pulling the library
|
|
115
|
+
* into consumers who never call this function.
|
|
116
|
+
*
|
|
117
|
+
* @param value - The string to scan for phone numbers.
|
|
118
|
+
* @returns Resolves to true if at least one phone number is found.
|
|
119
|
+
*/
|
|
120
|
+
declare function containsPhoneNumber(value: string): Promise<boolean>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Only Alpha
|
|
124
|
+
* Returns true when every character is a unicode letter.
|
|
125
|
+
*
|
|
126
|
+
* @param value - The string to test.
|
|
127
|
+
* @returns True if the string is non-empty and contains only letters.
|
|
128
|
+
*/
|
|
129
|
+
declare function onlyAlpha(value: string): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Only Numeric
|
|
132
|
+
* Returns true when every character is a digit (0-9).
|
|
133
|
+
*
|
|
134
|
+
* @param value - The string to test.
|
|
135
|
+
* @returns True if the string is non-empty and contains only digits.
|
|
136
|
+
*/
|
|
137
|
+
declare function onlyNumeric(value: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Only Alphanumeric
|
|
140
|
+
* Returns true when every character is a unicode letter or digit.
|
|
141
|
+
*
|
|
142
|
+
* @param value - The string to test.
|
|
143
|
+
* @returns True if the string is non-empty and contains only letters and digits.
|
|
144
|
+
*/
|
|
145
|
+
declare function onlyAlphanumeric(value: string): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Only Alphanumeric Space Hyphen
|
|
148
|
+
* Returns true when every character is a unicode letter, digit, whitespace,
|
|
149
|
+
* or hyphen.
|
|
150
|
+
*
|
|
151
|
+
* @param value - The string to test.
|
|
152
|
+
* @returns True if the string is non-empty and contains only the allowed set.
|
|
153
|
+
*/
|
|
154
|
+
declare function onlyAlphanumericSpaceHyphen(value: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Only Alpha Space Hyphen
|
|
157
|
+
* Returns true when every character is a unicode letter, whitespace,
|
|
158
|
+
* or hyphen.
|
|
159
|
+
*
|
|
160
|
+
* @param value - The string to test.
|
|
161
|
+
* @returns True if the string is non-empty and contains only the allowed set.
|
|
162
|
+
*/
|
|
163
|
+
declare function onlyAlphaSpaceHyphen(value: string): boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Empty To Undefined
|
|
167
|
+
* Converts empty strings and null to undefined. All other values pass through.
|
|
168
|
+
*
|
|
169
|
+
* @param value - The value to inspect.
|
|
170
|
+
* @returns Undefined if value is `""` or `null`, otherwise the original value.
|
|
171
|
+
*/
|
|
172
|
+
declare function emptyToUndefined(value: unknown): unknown;
|
|
173
|
+
/**
|
|
174
|
+
* To Title Case
|
|
175
|
+
* Converts a string to Title Case. Handles hyphens, apostrophes, and unicode.
|
|
176
|
+
*
|
|
177
|
+
* @param value - The string to transform.
|
|
178
|
+
* @returns The title-cased string.
|
|
179
|
+
*/
|
|
180
|
+
declare function toTitleCase(value: string): string;
|
|
181
|
+
/**
|
|
182
|
+
* To Slug
|
|
183
|
+
* Converts a string to a URL-safe slug. Lowercases, replaces non-alphanumeric
|
|
184
|
+
* characters with hyphens, collapses multiple hyphens, and trims edge hyphens.
|
|
185
|
+
*
|
|
186
|
+
* @param value - The string to transform.
|
|
187
|
+
* @returns The slugified string.
|
|
188
|
+
*/
|
|
189
|
+
declare function toSlug(value: string): string;
|
|
190
|
+
/**
|
|
191
|
+
* Strip HTML
|
|
192
|
+
* Removes HTML tags from a string.
|
|
193
|
+
*
|
|
194
|
+
* @param value - The string containing HTML.
|
|
195
|
+
* @returns The string with all HTML tags removed.
|
|
196
|
+
*/
|
|
197
|
+
declare function stripHtml(value: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* Collapse Whitespace
|
|
200
|
+
* Collapses multiple whitespace characters into a single space and trims.
|
|
201
|
+
*
|
|
202
|
+
* @param value - The string to normalize.
|
|
203
|
+
* @returns The string with collapsed whitespace.
|
|
204
|
+
*/
|
|
205
|
+
declare function collapseWhitespace(value: string): string;
|
|
206
|
+
|
|
207
|
+
export { collapseWhitespace, containsEmail, containsHtml, containsPhoneNumber, containsUrl, emptyToUndefined, hasDigits, hasLowercase, hasSpecial, hasUppercase, maxConsecutive, maxWords, minWords, noSpaces, onlyAlpha, onlyAlphaSpaceHyphen, onlyAlphanumeric, onlyAlphanumericSpaceHyphen, onlyNumeric, stripHtml, toSlug, toTitleCase };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Has Uppercase
|
|
3
|
+
* Checks that the string contains uppercase letters within the given bounds.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The string to inspect.
|
|
6
|
+
* @param min - Minimum number of uppercase letters required.
|
|
7
|
+
* @param max - Maximum number of uppercase letters allowed (optional).
|
|
8
|
+
* @returns True if the uppercase letter count is within [min, max].
|
|
9
|
+
*/
|
|
10
|
+
declare function hasUppercase(value: string, min: number, max?: number): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Has Lowercase
|
|
13
|
+
* Checks that the string contains lowercase letters within the given bounds.
|
|
14
|
+
*
|
|
15
|
+
* @param value - The string to inspect.
|
|
16
|
+
* @param min - Minimum number of lowercase letters required.
|
|
17
|
+
* @param max - Maximum number of lowercase letters allowed (optional).
|
|
18
|
+
* @returns True if the lowercase letter count is within [min, max].
|
|
19
|
+
*/
|
|
20
|
+
declare function hasLowercase(value: string, min: number, max?: number): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Has Digits
|
|
23
|
+
* Checks that the string contains digit characters within the given bounds.
|
|
24
|
+
*
|
|
25
|
+
* @param value - The string to inspect.
|
|
26
|
+
* @param min - Minimum number of digits required.
|
|
27
|
+
* @param max - Maximum number of digits allowed (optional).
|
|
28
|
+
* @returns True if the digit count is within [min, max].
|
|
29
|
+
*/
|
|
30
|
+
declare function hasDigits(value: string, min: number, max?: number): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Has Special
|
|
33
|
+
* Checks that the string contains special characters within the given bounds.
|
|
34
|
+
* Special characters are those that are not letters, digits, or whitespace.
|
|
35
|
+
*
|
|
36
|
+
* @param value - The string to inspect.
|
|
37
|
+
* @param min - Minimum number of special characters required.
|
|
38
|
+
* @param max - Maximum number of special characters allowed (optional).
|
|
39
|
+
* @returns True if the special character count is within [min, max].
|
|
40
|
+
*/
|
|
41
|
+
declare function hasSpecial(value: string, min: number, max?: number): boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Contains Email
|
|
45
|
+
* Returns true when the value contains what looks like an email address.
|
|
46
|
+
*
|
|
47
|
+
* @param value - The string to scan for email addresses.
|
|
48
|
+
* @returns True if an email-like pattern is detected.
|
|
49
|
+
*
|
|
50
|
+
* NOTE: Optimised for recall over precision — false positives are acceptable.
|
|
51
|
+
*/
|
|
52
|
+
declare function containsEmail(value: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Contains URL
|
|
55
|
+
* Returns true when the value contains what looks like a URL.
|
|
56
|
+
*
|
|
57
|
+
* @param value - The string to scan for URLs.
|
|
58
|
+
* @returns True if a URL-like pattern is detected.
|
|
59
|
+
*
|
|
60
|
+
* NOTE: Detects both protocol-prefixed (http/https) and www-prefixed URLs.
|
|
61
|
+
*/
|
|
62
|
+
declare function containsUrl(value: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Contains HTML
|
|
65
|
+
* Returns true when the value contains HTML-like tags.
|
|
66
|
+
*
|
|
67
|
+
* @param value - The string to scan for HTML tags.
|
|
68
|
+
* @returns True if an HTML tag pattern is detected.
|
|
69
|
+
*
|
|
70
|
+
* NOTE: Avoids false positives on comparison operators and emoticons.
|
|
71
|
+
*/
|
|
72
|
+
declare function containsHtml(value: string): boolean;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Max Words
|
|
76
|
+
* Returns true if value has at most `max` words.
|
|
77
|
+
*
|
|
78
|
+
* @param value - The string to inspect.
|
|
79
|
+
* @param max - Maximum number of words allowed (inclusive).
|
|
80
|
+
* @returns True if the word count is at most `max`.
|
|
81
|
+
*/
|
|
82
|
+
declare function maxWords(value: string, max: number): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Min Words
|
|
85
|
+
* Returns true if value has at least `min` words.
|
|
86
|
+
*
|
|
87
|
+
* @param value - The string to inspect.
|
|
88
|
+
* @param min - Minimum number of words required (inclusive).
|
|
89
|
+
* @returns True if the word count is at least `min`.
|
|
90
|
+
*/
|
|
91
|
+
declare function minWords(value: string, min: number): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Max Consecutive
|
|
94
|
+
* Returns true if no single character repeats more than `max` times
|
|
95
|
+
* consecutively. Handles unicode characters (emoji, CJK, etc.).
|
|
96
|
+
*
|
|
97
|
+
* @param value - The string to inspect.
|
|
98
|
+
* @param max - Maximum allowed consecutive repetitions (inclusive).
|
|
99
|
+
* @returns True if no character appears more than `max` times in a row.
|
|
100
|
+
*/
|
|
101
|
+
declare function maxConsecutive(value: string, max: number): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* No Spaces
|
|
104
|
+
* Returns true if value contains no whitespace characters.
|
|
105
|
+
*
|
|
106
|
+
* @param value - The string to inspect.
|
|
107
|
+
* @returns True if the string has no spaces, tabs, or newlines.
|
|
108
|
+
*/
|
|
109
|
+
declare function noSpaces(value: string): boolean;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Contains Phone Number
|
|
113
|
+
* Returns true when the value contains a phone number, detected via
|
|
114
|
+
* libphonenumber-js. Uses dynamic import to avoid pulling the library
|
|
115
|
+
* into consumers who never call this function.
|
|
116
|
+
*
|
|
117
|
+
* @param value - The string to scan for phone numbers.
|
|
118
|
+
* @returns Resolves to true if at least one phone number is found.
|
|
119
|
+
*/
|
|
120
|
+
declare function containsPhoneNumber(value: string): Promise<boolean>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Only Alpha
|
|
124
|
+
* Returns true when every character is a unicode letter.
|
|
125
|
+
*
|
|
126
|
+
* @param value - The string to test.
|
|
127
|
+
* @returns True if the string is non-empty and contains only letters.
|
|
128
|
+
*/
|
|
129
|
+
declare function onlyAlpha(value: string): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Only Numeric
|
|
132
|
+
* Returns true when every character is a digit (0-9).
|
|
133
|
+
*
|
|
134
|
+
* @param value - The string to test.
|
|
135
|
+
* @returns True if the string is non-empty and contains only digits.
|
|
136
|
+
*/
|
|
137
|
+
declare function onlyNumeric(value: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Only Alphanumeric
|
|
140
|
+
* Returns true when every character is a unicode letter or digit.
|
|
141
|
+
*
|
|
142
|
+
* @param value - The string to test.
|
|
143
|
+
* @returns True if the string is non-empty and contains only letters and digits.
|
|
144
|
+
*/
|
|
145
|
+
declare function onlyAlphanumeric(value: string): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Only Alphanumeric Space Hyphen
|
|
148
|
+
* Returns true when every character is a unicode letter, digit, whitespace,
|
|
149
|
+
* or hyphen.
|
|
150
|
+
*
|
|
151
|
+
* @param value - The string to test.
|
|
152
|
+
* @returns True if the string is non-empty and contains only the allowed set.
|
|
153
|
+
*/
|
|
154
|
+
declare function onlyAlphanumericSpaceHyphen(value: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Only Alpha Space Hyphen
|
|
157
|
+
* Returns true when every character is a unicode letter, whitespace,
|
|
158
|
+
* or hyphen.
|
|
159
|
+
*
|
|
160
|
+
* @param value - The string to test.
|
|
161
|
+
* @returns True if the string is non-empty and contains only the allowed set.
|
|
162
|
+
*/
|
|
163
|
+
declare function onlyAlphaSpaceHyphen(value: string): boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Empty To Undefined
|
|
167
|
+
* Converts empty strings and null to undefined. All other values pass through.
|
|
168
|
+
*
|
|
169
|
+
* @param value - The value to inspect.
|
|
170
|
+
* @returns Undefined if value is `""` or `null`, otherwise the original value.
|
|
171
|
+
*/
|
|
172
|
+
declare function emptyToUndefined(value: unknown): unknown;
|
|
173
|
+
/**
|
|
174
|
+
* To Title Case
|
|
175
|
+
* Converts a string to Title Case. Handles hyphens, apostrophes, and unicode.
|
|
176
|
+
*
|
|
177
|
+
* @param value - The string to transform.
|
|
178
|
+
* @returns The title-cased string.
|
|
179
|
+
*/
|
|
180
|
+
declare function toTitleCase(value: string): string;
|
|
181
|
+
/**
|
|
182
|
+
* To Slug
|
|
183
|
+
* Converts a string to a URL-safe slug. Lowercases, replaces non-alphanumeric
|
|
184
|
+
* characters with hyphens, collapses multiple hyphens, and trims edge hyphens.
|
|
185
|
+
*
|
|
186
|
+
* @param value - The string to transform.
|
|
187
|
+
* @returns The slugified string.
|
|
188
|
+
*/
|
|
189
|
+
declare function toSlug(value: string): string;
|
|
190
|
+
/**
|
|
191
|
+
* Strip HTML
|
|
192
|
+
* Removes HTML tags from a string.
|
|
193
|
+
*
|
|
194
|
+
* @param value - The string containing HTML.
|
|
195
|
+
* @returns The string with all HTML tags removed.
|
|
196
|
+
*/
|
|
197
|
+
declare function stripHtml(value: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* Collapse Whitespace
|
|
200
|
+
* Collapses multiple whitespace characters into a single space and trims.
|
|
201
|
+
*
|
|
202
|
+
* @param value - The string to normalize.
|
|
203
|
+
* @returns The string with collapsed whitespace.
|
|
204
|
+
*/
|
|
205
|
+
declare function collapseWhitespace(value: string): string;
|
|
206
|
+
|
|
207
|
+
export { collapseWhitespace, containsEmail, containsHtml, containsPhoneNumber, containsUrl, emptyToUndefined, hasDigits, hasLowercase, hasSpecial, hasUppercase, maxConsecutive, maxWords, minWords, noSpaces, onlyAlpha, onlyAlphaSpaceHyphen, onlyAlphanumeric, onlyAlphanumericSpaceHyphen, onlyNumeric, stripHtml, toSlug, toTitleCase };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "../chunk-4HUGF4EZ.js";
|
|
2
|
+
import {
|
|
3
|
+
collapseWhitespace,
|
|
4
|
+
containsEmail,
|
|
5
|
+
containsHtml,
|
|
6
|
+
containsUrl,
|
|
7
|
+
emptyToUndefined,
|
|
8
|
+
hasDigits,
|
|
9
|
+
hasLowercase,
|
|
10
|
+
hasSpecial,
|
|
11
|
+
hasUppercase,
|
|
12
|
+
maxConsecutive,
|
|
13
|
+
maxWords,
|
|
14
|
+
minWords,
|
|
15
|
+
noSpaces,
|
|
16
|
+
onlyAlpha,
|
|
17
|
+
onlyAlphaSpaceHyphen,
|
|
18
|
+
onlyAlphanumeric,
|
|
19
|
+
onlyAlphanumericSpaceHyphen,
|
|
20
|
+
onlyNumeric,
|
|
21
|
+
stripHtml,
|
|
22
|
+
toSlug,
|
|
23
|
+
toTitleCase
|
|
24
|
+
} from "../chunk-6MGS4JWP.js";
|
|
25
|
+
import {
|
|
26
|
+
containsPhoneNumber
|
|
27
|
+
} from "../chunk-FD77PZXB.js";
|
|
28
|
+
export {
|
|
29
|
+
collapseWhitespace,
|
|
30
|
+
containsEmail,
|
|
31
|
+
containsHtml,
|
|
32
|
+
containsPhoneNumber,
|
|
33
|
+
containsUrl,
|
|
34
|
+
emptyToUndefined,
|
|
35
|
+
hasDigits,
|
|
36
|
+
hasLowercase,
|
|
37
|
+
hasSpecial,
|
|
38
|
+
hasUppercase,
|
|
39
|
+
maxConsecutive,
|
|
40
|
+
maxWords,
|
|
41
|
+
minWords,
|
|
42
|
+
noSpaces,
|
|
43
|
+
onlyAlpha,
|
|
44
|
+
onlyAlphaSpaceHyphen,
|
|
45
|
+
onlyAlphanumeric,
|
|
46
|
+
onlyAlphanumericSpaceHyphen,
|
|
47
|
+
onlyNumeric,
|
|
48
|
+
stripHtml,
|
|
49
|
+
toSlug,
|
|
50
|
+
toTitleCase
|
|
51
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/loaders/currencyCodes.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadCurrencyCodes() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const raw = (await Promise.resolve().then(() => _interopRequireWildcard(require("./currencyCodes-GU6W3HSN.cjs")))).default;
|
|
7
|
+
cache = new Set(raw);
|
|
8
|
+
return cache;
|
|
9
|
+
}
|
|
10
|
+
function getCurrencyCodes() {
|
|
11
|
+
if (cache === void 0) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"validex: Currency codes not loaded. Use parseAsync() or call preloadData() first."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return cache;
|
|
17
|
+
}
|
|
18
|
+
function clearCurrencyCodesCache() {
|
|
19
|
+
cache = void 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.loadCurrencyCodes = loadCurrencyCodes; exports.getCurrencyCodes = getCurrencyCodes; exports.clearCurrencyCodesCache = clearCurrencyCodesCache;
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/loaders/ibanPatterns.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadIbanPatterns() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const raw = (await Promise.resolve().then(() => _interopRequireWildcard(require("./ibanPatterns-2PM32RIY.cjs")))).default;
|
|
7
|
+
const map = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const entry of raw) {
|
|
9
|
+
map.set(entry.country, {
|
|
10
|
+
length: entry.length,
|
|
11
|
+
regex: new RegExp(entry.regex)
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
cache = map;
|
|
15
|
+
return cache;
|
|
16
|
+
}
|
|
17
|
+
function getIbanPatterns() {
|
|
18
|
+
if (cache === void 0) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"validex: IBAN patterns not loaded. Use parseAsync() or call preloadData() first."
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return cache;
|
|
24
|
+
}
|
|
25
|
+
function clearIbanPatternsCache() {
|
|
26
|
+
cache = void 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
exports.loadIbanPatterns = loadIbanPatterns; exports.getIbanPatterns = getIbanPatterns; exports.clearIbanPatternsCache = clearIbanPatternsCache;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/loaders/vatPatterns.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadVatPatterns() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const raw = (await import("./vatPatterns-BLRXHNCP.js")).default;
|
|
7
|
+
const map = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const entry of raw) {
|
|
9
|
+
map.set(entry.country, new RegExp(entry.regex));
|
|
10
|
+
}
|
|
11
|
+
cache = map;
|
|
12
|
+
return cache;
|
|
13
|
+
}
|
|
14
|
+
function getVatPatterns() {
|
|
15
|
+
if (cache === void 0) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
"validex: VAT patterns not loaded. Use parseAsync() or call preloadData() first."
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return cache;
|
|
21
|
+
}
|
|
22
|
+
function clearVatPatternsCache() {
|
|
23
|
+
cache = void 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
loadVatPatterns,
|
|
28
|
+
getVatPatterns,
|
|
29
|
+
clearVatPatternsCache
|
|
30
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/loaders/disposableDomains.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadDisposableDomains() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const { disposableEmailBlocklistSet } = await Promise.resolve().then(() => _interopRequireWildcard(require("disposable-email-domains-js")));
|
|
7
|
+
cache = disposableEmailBlocklistSet();
|
|
8
|
+
return cache;
|
|
9
|
+
}
|
|
10
|
+
function getDisposableDomains() {
|
|
11
|
+
if (cache === void 0) {
|
|
12
|
+
throw new Error("Disposable domains not loaded. Call loadDisposableDomains() or preloadData({ disposable: true }) first.");
|
|
13
|
+
}
|
|
14
|
+
return cache;
|
|
15
|
+
}
|
|
16
|
+
function clearDisposableDomainsCache() {
|
|
17
|
+
cache = void 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.loadDisposableDomains = loadDisposableDomains; exports.getDisposableDomains = getDisposableDomains; exports.clearDisposableDomainsCache = clearDisposableDomainsCache;
|