utilitify-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.
Files changed (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +338 -0
  3. package/dist/async.cjs +25 -0
  4. package/dist/async.cjs.map +1 -0
  5. package/dist/async.d.cts +104 -0
  6. package/dist/async.d.ts +104 -0
  7. package/dist/async.js +4 -0
  8. package/dist/async.js.map +1 -0
  9. package/dist/chunk-2ICNRTSN.cjs +346 -0
  10. package/dist/chunk-2ICNRTSN.cjs.map +1 -0
  11. package/dist/chunk-3DPF72DY.js +170 -0
  12. package/dist/chunk-3DPF72DY.js.map +1 -0
  13. package/dist/chunk-4CV4JOE5.js +24 -0
  14. package/dist/chunk-4CV4JOE5.js.map +1 -0
  15. package/dist/chunk-4SLYNSLH.cjs +783 -0
  16. package/dist/chunk-4SLYNSLH.cjs.map +1 -0
  17. package/dist/chunk-5WP7DWCG.js +1285 -0
  18. package/dist/chunk-5WP7DWCG.js.map +1 -0
  19. package/dist/chunk-BMQ6YPKV.js +876 -0
  20. package/dist/chunk-BMQ6YPKV.js.map +1 -0
  21. package/dist/chunk-BZCMWUKS.cjs +479 -0
  22. package/dist/chunk-BZCMWUKS.cjs.map +1 -0
  23. package/dist/chunk-C5R744DY.cjs +173 -0
  24. package/dist/chunk-C5R744DY.cjs.map +1 -0
  25. package/dist/chunk-C75J62CV.cjs +913 -0
  26. package/dist/chunk-C75J62CV.cjs.map +1 -0
  27. package/dist/chunk-CZLDE2OZ.cjs +28 -0
  28. package/dist/chunk-CZLDE2OZ.cjs.map +1 -0
  29. package/dist/chunk-DSMB6AF6.cjs +193 -0
  30. package/dist/chunk-DSMB6AF6.cjs.map +1 -0
  31. package/dist/chunk-ETWGPOPY.js +426 -0
  32. package/dist/chunk-ETWGPOPY.js.map +1 -0
  33. package/dist/chunk-FQBPVN63.cjs +403 -0
  34. package/dist/chunk-FQBPVN63.cjs.map +1 -0
  35. package/dist/chunk-G4GYQGTW.cjs +178 -0
  36. package/dist/chunk-G4GYQGTW.cjs.map +1 -0
  37. package/dist/chunk-GFDMZDMI.js +486 -0
  38. package/dist/chunk-GFDMZDMI.js.map +1 -0
  39. package/dist/chunk-HOTOYIPB.js +171 -0
  40. package/dist/chunk-HOTOYIPB.js.map +1 -0
  41. package/dist/chunk-HYADH4ZX.js +176 -0
  42. package/dist/chunk-HYADH4ZX.js.map +1 -0
  43. package/dist/chunk-JBN7C5WE.js +255 -0
  44. package/dist/chunk-JBN7C5WE.js.map +1 -0
  45. package/dist/chunk-JNCTPFTD.cjs +25 -0
  46. package/dist/chunk-JNCTPFTD.cjs.map +1 -0
  47. package/dist/chunk-N3BH3BV7.js +21 -0
  48. package/dist/chunk-N3BH3BV7.js.map +1 -0
  49. package/dist/chunk-NFPGAVRQ.js +749 -0
  50. package/dist/chunk-NFPGAVRQ.js.map +1 -0
  51. package/dist/chunk-OFFRGRBN.cjs +1332 -0
  52. package/dist/chunk-OFFRGRBN.cjs.map +1 -0
  53. package/dist/chunk-OZLKYIZL.cjs +490 -0
  54. package/dist/chunk-OZLKYIZL.cjs.map +1 -0
  55. package/dist/chunk-P3NUK46X.js +145 -0
  56. package/dist/chunk-P3NUK46X.js.map +1 -0
  57. package/dist/chunk-P7P2B7ZI.cjs +429 -0
  58. package/dist/chunk-P7P2B7ZI.cjs.map +1 -0
  59. package/dist/chunk-PB6SKSJN.cjs +150 -0
  60. package/dist/chunk-PB6SKSJN.cjs.map +1 -0
  61. package/dist/chunk-R3IXCJR7.js +378 -0
  62. package/dist/chunk-R3IXCJR7.js.map +1 -0
  63. package/dist/chunk-SD6P3WEJ.js +324 -0
  64. package/dist/chunk-SD6P3WEJ.js.map +1 -0
  65. package/dist/chunk-YSCHP26P.js +451 -0
  66. package/dist/chunk-YSCHP26P.js.map +1 -0
  67. package/dist/chunk-ZLMPRPCY.cjs +274 -0
  68. package/dist/chunk-ZLMPRPCY.cjs.map +1 -0
  69. package/dist/common-CBDYNJeh.d.cts +48 -0
  70. package/dist/common-CBDYNJeh.d.ts +48 -0
  71. package/dist/constants.cjs +42 -0
  72. package/dist/constants.cjs.map +1 -0
  73. package/dist/constants.d.cts +60 -0
  74. package/dist/constants.d.ts +60 -0
  75. package/dist/constants.js +5 -0
  76. package/dist/constants.js.map +1 -0
  77. package/dist/country/index.cjs +154 -0
  78. package/dist/country/index.cjs.map +1 -0
  79. package/dist/country/index.d.cts +1 -0
  80. package/dist/country/index.d.ts +1 -0
  81. package/dist/country/index.js +5 -0
  82. package/dist/country/index.js.map +1 -0
  83. package/dist/date/index.cjs +117 -0
  84. package/dist/date/index.cjs.map +1 -0
  85. package/dist/date/index.d.cts +283 -0
  86. package/dist/date/index.d.ts +283 -0
  87. package/dist/date/index.js +4 -0
  88. package/dist/date/index.js.map +1 -0
  89. package/dist/environment/index.cjs +73 -0
  90. package/dist/environment/index.cjs.map +1 -0
  91. package/dist/environment/index.d.cts +127 -0
  92. package/dist/environment/index.d.ts +127 -0
  93. package/dist/environment/index.js +4 -0
  94. package/dist/environment/index.js.map +1 -0
  95. package/dist/form/index.cjs +81 -0
  96. package/dist/form/index.cjs.map +1 -0
  97. package/dist/form/index.d.cts +227 -0
  98. package/dist/form/index.d.ts +227 -0
  99. package/dist/form/index.js +4 -0
  100. package/dist/form/index.js.map +1 -0
  101. package/dist/i18n.cjs +37 -0
  102. package/dist/i18n.cjs.map +1 -0
  103. package/dist/i18n.d.cts +102 -0
  104. package/dist/i18n.d.ts +102 -0
  105. package/dist/i18n.js +4 -0
  106. package/dist/i18n.js.map +1 -0
  107. package/dist/index-BXBmBHyL.d.ts +718 -0
  108. package/dist/index-BYsUCP3u.d.cts +718 -0
  109. package/dist/index-Cl26FrAZ.d.cts +362 -0
  110. package/dist/index-Cl26FrAZ.d.ts +362 -0
  111. package/dist/index.cjs +1265 -0
  112. package/dist/index.cjs.map +1 -0
  113. package/dist/index.d.cts +205 -0
  114. package/dist/index.d.ts +205 -0
  115. package/dist/index.js +277 -0
  116. package/dist/index.js.map +1 -0
  117. package/dist/schema.cjs +13 -0
  118. package/dist/schema.cjs.map +1 -0
  119. package/dist/schema.d.cts +84 -0
  120. package/dist/schema.d.ts +84 -0
  121. package/dist/schema.js +4 -0
  122. package/dist/schema.js.map +1 -0
  123. package/dist/security/index.cjs +94 -0
  124. package/dist/security/index.cjs.map +1 -0
  125. package/dist/security/index.d.cts +216 -0
  126. package/dist/security/index.d.ts +216 -0
  127. package/dist/security/index.js +5 -0
  128. package/dist/security/index.js.map +1 -0
  129. package/dist/string/index.cjs +153 -0
  130. package/dist/string/index.cjs.map +1 -0
  131. package/dist/string/index.d.cts +471 -0
  132. package/dist/string/index.d.ts +471 -0
  133. package/dist/string/index.js +4 -0
  134. package/dist/string/index.js.map +1 -0
  135. package/dist/transform/index.cjs +105 -0
  136. package/dist/transform/index.cjs.map +1 -0
  137. package/dist/transform/index.d.cts +271 -0
  138. package/dist/transform/index.d.ts +271 -0
  139. package/dist/transform/index.js +4 -0
  140. package/dist/transform/index.js.map +1 -0
  141. package/dist/validators/index.cjs +195 -0
  142. package/dist/validators/index.cjs.map +1 -0
  143. package/dist/validators/index.d.cts +2 -0
  144. package/dist/validators/index.d.ts +2 -0
  145. package/dist/validators/index.js +6 -0
  146. package/dist/validators/index.js.map +1 -0
  147. package/package.json +229 -0
@@ -0,0 +1,718 @@
1
+ import { B as BaseOptions, V as ValidationResult, I as IValidationError } from './common-CBDYNJeh.js';
2
+
3
+ /**
4
+ * Name validation options
5
+ */
6
+ interface NameOptions extends BaseOptions {
7
+ /** Minimum length (default: 2) */
8
+ minLength?: number;
9
+ /** Maximum length (default: 100) */
10
+ maxLength?: number;
11
+ /** Allow special characters (default: true) */
12
+ allowSpecialChars?: boolean;
13
+ /** Allow numbers (default: false) */
14
+ allowNumbers?: boolean;
15
+ /** Allowed scripts */
16
+ allowedScripts?: ('latin' | 'arabic' | 'cjk' | 'cyrillic' | 'devanagari')[];
17
+ }
18
+ /**
19
+ * Name validation result
20
+ */
21
+ interface NameValidationResult extends ValidationResult {
22
+ sanitized: string;
23
+ detectedScript: 'latin' | 'arabic' | 'cjk' | 'cyrillic' | 'devanagari' | 'mixed' | 'unknown';
24
+ }
25
+ /**
26
+ * Email validation options
27
+ */
28
+ interface EmailOptions extends BaseOptions {
29
+ /** Check for disposable email domains (default: true) */
30
+ checkDisposable?: boolean;
31
+ /** Check for corporate domains */
32
+ checkCorporate?: boolean;
33
+ /** Allowed domains whitelist */
34
+ allowedDomains?: string[];
35
+ /** Blocked domains blacklist */
36
+ blockedDomains?: string[];
37
+ }
38
+ /**
39
+ * Email validation result
40
+ */
41
+ interface EmailValidationResult extends ValidationResult {
42
+ isDisposable: boolean;
43
+ isCorporate: boolean;
44
+ normalized: string;
45
+ domain: string;
46
+ localPart: string;
47
+ }
48
+ /**
49
+ * Phone validation options
50
+ */
51
+ interface PhoneOptions extends BaseOptions {
52
+ /** Country code for validation (e.g., 'US', 'PK') */
53
+ countryCode?: string;
54
+ /** Strict mode - require exact format */
55
+ strict?: boolean;
56
+ /** Allow mobile only */
57
+ mobileOnly?: boolean;
58
+ }
59
+ /**
60
+ * Phone validation result
61
+ */
62
+ interface PhoneValidationResult extends ValidationResult {
63
+ countryCode: string;
64
+ nationalNumber: string;
65
+ formatted: {
66
+ national: string;
67
+ international: string;
68
+ e164: string;
69
+ };
70
+ type: 'mobile' | 'landline' | 'toll_free' | 'premium' | 'unknown';
71
+ isValid: boolean;
72
+ }
73
+ /**
74
+ * Username validation options
75
+ */
76
+ interface UsernameOptions extends BaseOptions {
77
+ /** Minimum length (default: 3) */
78
+ minLength?: number;
79
+ /** Maximum length (default: 30) */
80
+ maxLength?: number;
81
+ /** Allowed characters pattern */
82
+ allowedChars?: RegExp;
83
+ /** Reserved usernames list */
84
+ reserved?: string[];
85
+ /** Allow email format */
86
+ allowEmail?: boolean;
87
+ }
88
+ /**
89
+ * Username validation result
90
+ */
91
+ interface UsernameValidationResult extends ValidationResult {
92
+ sanitized: string;
93
+ isReserved: boolean;
94
+ }
95
+ /**
96
+ * Combined user data for validateUser()
97
+ */
98
+ interface UserData {
99
+ name?: string;
100
+ email?: string;
101
+ phone?: string;
102
+ country?: string;
103
+ username?: string;
104
+ password?: string;
105
+ dateOfBirth?: string | Date;
106
+ }
107
+ /**
108
+ * User validation options
109
+ */
110
+ interface UserValidationOptions extends BaseOptions {
111
+ name?: NameOptions;
112
+ email?: EmailOptions;
113
+ phone?: PhoneOptions;
114
+ username?: UsernameOptions;
115
+ /** Required fields */
116
+ required?: (keyof UserData)[];
117
+ }
118
+ /**
119
+ * User validation result
120
+ */
121
+ interface UserValidationResult extends ValidationResult {
122
+ data: {
123
+ name?: NameValidationResult;
124
+ email?: EmailValidationResult;
125
+ phone?: PhoneValidationResult;
126
+ username?: UsernameValidationResult;
127
+ };
128
+ sanitized: Partial<UserData>;
129
+ }
130
+
131
+ /**
132
+ * Validate an email address with comprehensive checks
133
+ *
134
+ * @param email - Email address to validate
135
+ * @param options - Validation options
136
+ * @returns Validation result with details
137
+ * @since 1.0.0
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * const result = validateEmail('user@example.com');
142
+ * if (result.isValid) {
143
+ * console.log('Email is valid:', result.normalized);
144
+ * }
145
+ * ```
146
+ */
147
+ declare function validateEmail(email: string, options?: EmailOptions): EmailValidationResult;
148
+ /**
149
+ * Simple email format validation
150
+ *
151
+ * @param email - Email to validate
152
+ * @returns true if email format is valid
153
+ * @since 1.0.0
154
+ */
155
+ declare function isValidEmail(email: string): boolean;
156
+ /**
157
+ * Check if email domain is disposable
158
+ *
159
+ * @param email - Email to check
160
+ * @returns true if domain is disposable
161
+ * @since 1.0.0
162
+ */
163
+ declare function isDisposableEmail(email: string): boolean;
164
+ /**
165
+ * Normalize email address
166
+ * - Lowercase
167
+ * - Remove dots from Gmail local part
168
+ * - Remove + aliases
169
+ *
170
+ * @param email - Email to normalize
171
+ * @returns Normalized email
172
+ * @since 1.0.0
173
+ */
174
+ declare function normalizeEmail(email: string): string;
175
+ /**
176
+ * Extract domain from email
177
+ *
178
+ * @param email - Email address
179
+ * @returns Domain part of email
180
+ * @since 1.0.0
181
+ */
182
+ declare function getEmailDomain(email: string): string;
183
+
184
+ /**
185
+ * Validate a name with multilingual support
186
+ *
187
+ * @param name - Name to validate
188
+ * @param options - Validation options
189
+ * @returns Validation result
190
+ * @since 1.0.0
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * const result = validateName('John Doe');
195
+ * if (result.isValid) {
196
+ * console.log('Name is valid:', result.sanitized);
197
+ * }
198
+ * ```
199
+ */
200
+ declare function validateName(name: string, options?: NameOptions): NameValidationResult;
201
+ /**
202
+ * Simple name validation check
203
+ *
204
+ * @param name - Name to validate
205
+ * @returns true if name is valid
206
+ * @since 1.0.0
207
+ */
208
+ declare function isValidName(name: string): boolean;
209
+ /**
210
+ * Sanitize a name string
211
+ * - Trim whitespace
212
+ * - Normalize unicode
213
+ * - Remove excessive spaces
214
+ * - Capitalize properly
215
+ *
216
+ * @param name - Name to sanitize
217
+ * @returns Sanitized name
218
+ * @since 1.0.0
219
+ */
220
+ declare function sanitizeName(name: string): string;
221
+ /**
222
+ * Detect the primary script used in a string
223
+ *
224
+ * @param text - Text to analyze
225
+ * @returns Detected script
226
+ * @since 1.0.0
227
+ */
228
+ declare function detectScript(text: string): 'latin' | 'arabic' | 'cjk' | 'cyrillic' | 'devanagari' | 'mixed' | 'unknown';
229
+ /**
230
+ * Format name to proper title case
231
+ *
232
+ * @param name - Name to format
233
+ * @returns Formatted name
234
+ * @since 1.0.0
235
+ */
236
+ declare function formatName(name: string): string;
237
+ /**
238
+ * Split full name into parts
239
+ *
240
+ * @param fullName - Full name string
241
+ * @returns Object with firstName, lastName, middleName
242
+ * @since 1.0.0
243
+ */
244
+ declare function splitName(fullName: string): {
245
+ firstName: string;
246
+ lastName: string;
247
+ middleName?: string;
248
+ };
249
+
250
+ /**
251
+ * Validate a phone number
252
+ *
253
+ * @param phone - Phone number to validate
254
+ * @param options - Validation options
255
+ * @returns Validation result
256
+ * @since 1.0.0
257
+ *
258
+ * @example
259
+ * ```typescript
260
+ * const result = validatePhone('+1 555-123-4567', { countryCode: 'US' });
261
+ * if (result.isValid) {
262
+ * console.log('Phone:', result.formatted.international);
263
+ * }
264
+ * ```
265
+ */
266
+ declare function validatePhone(phone: string, options?: PhoneOptions): PhoneValidationResult;
267
+ /**
268
+ * Simple phone validation
269
+ *
270
+ * @param phone - Phone number to validate
271
+ * @param countryCode - Optional country code
272
+ * @returns true if phone is valid
273
+ * @since 1.0.0
274
+ */
275
+ declare function isValidPhone(phone: string, countryCode?: string): boolean;
276
+ /**
277
+ * Format phone number to specified format
278
+ *
279
+ * @param phone - Phone number
280
+ * @param format - Format type
281
+ * @param countryCode - Country code
282
+ * @returns Formatted phone number
283
+ * @since 1.0.0
284
+ */
285
+ declare function formatPhone(phone: string, format?: 'national' | 'international' | 'e164', countryCode?: string): string;
286
+ /**
287
+ * Parse phone number and extract components
288
+ *
289
+ * @param phone - Phone number
290
+ * @returns Parsed components
291
+ * @since 1.0.0
292
+ */
293
+ declare function parsePhone(phone: string): {
294
+ countryCode: string;
295
+ dialCode: string;
296
+ nationalNumber: string;
297
+ isValid: boolean;
298
+ };
299
+
300
+ /**
301
+ * Validate a username
302
+ *
303
+ * @param username - Username to validate
304
+ * @param options - Validation options
305
+ * @returns Validation result
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * const result = validateUsername('john_doe');
310
+ * if (result.isValid) {
311
+ * console.log('Username is valid');
312
+ * }
313
+ * ```
314
+ */
315
+ declare function validateUsername(username: string, options?: UsernameOptions): UsernameValidationResult;
316
+ /**
317
+ * Simple username validation
318
+ *
319
+ * @param username - Username to validate
320
+ * @returns true if username is valid
321
+ */
322
+ declare function isValidUsername(username: string): boolean;
323
+ /**
324
+ * Check if username is reserved
325
+ *
326
+ * @param username - Username to check
327
+ * @param additionalReserved - Additional reserved usernames
328
+ * @returns true if username is reserved
329
+ */
330
+ declare function isReservedUsername(username: string, additionalReserved?: string[]): boolean;
331
+ /**
332
+ * Sanitize username
333
+ *
334
+ * @param username - Username to sanitize
335
+ * @returns Sanitized username
336
+ */
337
+ declare function sanitizeUsername(username: string): string;
338
+ /**
339
+ * Generate username suggestions based on input
340
+ *
341
+ * @param base - Base string (e.g., name or email)
342
+ * @param count - Number of suggestions
343
+ * @returns Array of username suggestions
344
+ */
345
+ declare function suggestUsernames(base: string, count?: number): string[];
346
+
347
+ /**
348
+ * URL validation options
349
+ */
350
+ interface UrlOptions {
351
+ /** Require HTTPS (default: false) */
352
+ requireHttps?: boolean;
353
+ /** Allow localhost (default: true) */
354
+ allowLocalhost?: boolean;
355
+ /** Allow IP addresses (default: true) */
356
+ allowIpAddress?: boolean;
357
+ /** Allowed protocols (default: ['http:', 'https:']) */
358
+ allowedProtocols?: string[];
359
+ /** Blocked domains */
360
+ blockedDomains?: string[];
361
+ /** Require specific TLDs */
362
+ allowedTlds?: string[];
363
+ /** Custom error messages */
364
+ messages?: {
365
+ required?: string;
366
+ invalidFormat?: string;
367
+ invalidProtocol?: string;
368
+ blockedDomain?: string;
369
+ invalidTld?: string;
370
+ };
371
+ }
372
+ /**
373
+ * URL validation result
374
+ */
375
+ interface UrlValidationResult {
376
+ /** Whether URL is valid */
377
+ isValid: boolean;
378
+ /** Validation errors */
379
+ errors: IValidationError[];
380
+ /** Parsed URL components */
381
+ parsed?: {
382
+ protocol: string;
383
+ hostname: string;
384
+ port: string;
385
+ pathname: string;
386
+ search: string;
387
+ hash: string;
388
+ };
389
+ /** Normalized URL */
390
+ normalized: string;
391
+ }
392
+ /**
393
+ * Validate a URL
394
+ *
395
+ * @param url - URL to validate
396
+ * @param options - Validation options
397
+ * @returns Validation result
398
+ *
399
+ * @example
400
+ * ```typescript
401
+ * const result = validateUrl('https://example.com/path');
402
+ * if (result.isValid) {
403
+ * console.log('Valid URL:', result.normalized);
404
+ * }
405
+ * ```
406
+ */
407
+ declare function validateUrl(url: string, options?: UrlOptions): UrlValidationResult;
408
+ /**
409
+ * Simple URL format validation
410
+ *
411
+ * @param url - URL to validate
412
+ * @returns true if URL format is valid
413
+ */
414
+ declare function isValidUrl(url: string): boolean;
415
+ /**
416
+ * Check if URL is HTTPS
417
+ *
418
+ * @param url - URL to check
419
+ * @returns true if URL uses HTTPS
420
+ */
421
+ declare function isHttpsUrl(url: string): boolean;
422
+ /**
423
+ * Extract domain from URL
424
+ *
425
+ * @param url - URL to extract from
426
+ * @returns Domain/hostname or empty string
427
+ */
428
+ declare function getUrlDomain(url: string): string;
429
+ /**
430
+ * Normalize URL (lowercase host, remove trailing slash, etc.)
431
+ *
432
+ * @param url - URL to normalize
433
+ * @returns Normalized URL or empty string
434
+ */
435
+ declare function normalizeUrl(url: string): string;
436
+ /**
437
+ * Check if URL is a data URL
438
+ *
439
+ * @param url - URL to check
440
+ * @returns true if data URL
441
+ */
442
+ declare function isDataUrl(url: string): boolean;
443
+ /**
444
+ * Check if URL contains potentially dangerous schemes
445
+ *
446
+ * @param url - URL to check
447
+ * @returns true if dangerous
448
+ */
449
+ declare function isDangerousUrl(url: string): boolean;
450
+
451
+ /**
452
+ * Credit card validation options
453
+ */
454
+ interface CreditCardOptions {
455
+ /** Check Luhn algorithm (default: true) */
456
+ checkLuhn?: boolean;
457
+ /** Allowed card types */
458
+ allowedTypes?: CardType[];
459
+ /** Custom error messages */
460
+ messages?: {
461
+ required?: string;
462
+ invalidFormat?: string;
463
+ invalidLuhn?: string;
464
+ typeNotAllowed?: string;
465
+ };
466
+ }
467
+ /**
468
+ * Credit card validation result
469
+ */
470
+ interface CreditCardValidationResult {
471
+ /** Whether card number is valid */
472
+ isValid: boolean;
473
+ /** Validation errors */
474
+ errors: IValidationError[];
475
+ /** Detected card type */
476
+ cardType: CardType | null;
477
+ /** Masked card number (last 4 digits visible) */
478
+ masked: string;
479
+ /** Cleaned card number (digits only) */
480
+ cleaned: string;
481
+ }
482
+ /**
483
+ * Supported card types
484
+ */
485
+ type CardType = 'visa' | 'mastercard' | 'amex' | 'discover' | 'diners' | 'jcb' | 'unionpay' | 'maestro' | 'unknown';
486
+ /**
487
+ * Validate a credit card number
488
+ *
489
+ * @param cardNumber - Credit card number to validate
490
+ * @param options - Validation options
491
+ * @returns Validation result
492
+ *
493
+ * @example
494
+ * ```typescript
495
+ * const result = validateCreditCard('4111111111111111');
496
+ * if (result.isValid) {
497
+ * console.log('Card type:', result.cardType); // 'visa'
498
+ * }
499
+ * ```
500
+ */
501
+ declare function validateCreditCard(cardNumber: string, options?: CreditCardOptions): CreditCardValidationResult;
502
+ /**
503
+ * Simple credit card validation
504
+ *
505
+ * @param cardNumber - Card number to validate
506
+ * @returns true if valid
507
+ */
508
+ declare function isValidCreditCard(cardNumber: string): boolean;
509
+ /**
510
+ * Detect credit card type from number
511
+ *
512
+ * @param cardNumber - Card number
513
+ * @returns Detected card type
514
+ */
515
+ declare function detectCardType(cardNumber: string): CardType;
516
+ /**
517
+ * Get card type from prefix (for real-time typing)
518
+ *
519
+ * @param cardNumber - Partial card number
520
+ * @returns Detected card type or null
521
+ */
522
+ declare function getCardTypeFromPrefix(cardNumber: string): CardType | null;
523
+ /**
524
+ * Luhn algorithm check (mod 10)
525
+ *
526
+ * @param cardNumber - Card number (digits only)
527
+ * @returns true if passes Luhn check
528
+ */
529
+ declare function luhnCheck(cardNumber: string): boolean;
530
+ /**
531
+ * Mask credit card number (show last 4 digits)
532
+ *
533
+ * @param cardNumber - Card number to mask
534
+ * @param maskChar - Character to use for masking (default: '*')
535
+ * @returns Masked card number
536
+ */
537
+ declare function maskCardNumber(cardNumber: string, maskChar?: string): string;
538
+ /**
539
+ * Format credit card number with spaces
540
+ *
541
+ * @param cardNumber - Card number to format
542
+ * @returns Formatted card number
543
+ */
544
+ declare function formatCardNumber(cardNumber: string): string;
545
+ /**
546
+ * Validate CVV/CVC
547
+ *
548
+ * @param cvv - CVV code
549
+ * @param cardType - Card type (amex has 4-digit CVV)
550
+ * @returns true if valid
551
+ */
552
+ declare function isValidCVV(cvv: string, cardType?: CardType): boolean;
553
+ /**
554
+ * Validate expiry date
555
+ *
556
+ * @param month - Expiry month (1-12 or '01'-'12')
557
+ * @param year - Expiry year (2-digit or 4-digit)
558
+ * @returns true if not expired
559
+ */
560
+ declare function isValidExpiry(month: string | number, year: string | number): boolean;
561
+
562
+ /**
563
+ * IP validation options
564
+ */
565
+ interface IpOptions {
566
+ /** Version to validate (default: both) */
567
+ version?: 4 | 6 | 'both';
568
+ /** Allow CIDR notation (default: false) */
569
+ allowCidr?: boolean;
570
+ /** Allow private/local IPs (default: true) */
571
+ allowPrivate?: boolean;
572
+ /** Custom error messages */
573
+ messages?: {
574
+ required?: string;
575
+ invalidFormat?: string;
576
+ versionNotAllowed?: string;
577
+ privateNotAllowed?: string;
578
+ };
579
+ }
580
+ /**
581
+ * IP validation result
582
+ */
583
+ interface IpValidationResult {
584
+ /** Whether IP is valid */
585
+ isValid: boolean;
586
+ /** Validation errors */
587
+ errors: IValidationError[];
588
+ /** IP version (4 or 6) */
589
+ version: 4 | 6 | null;
590
+ /** Whether IP is private/local */
591
+ isPrivate: boolean;
592
+ /** Whether IP is loopback */
593
+ isLoopback: boolean;
594
+ /** CIDR prefix if present */
595
+ cidr: number | null;
596
+ /** Normalized IP */
597
+ normalized: string;
598
+ }
599
+ /**
600
+ * Validate an IP address
601
+ *
602
+ * @param ip - IP address to validate
603
+ * @param options - Validation options
604
+ * @returns Validation result
605
+ *
606
+ * @example
607
+ * ```typescript
608
+ * const result = validateIp('192.168.1.1');
609
+ * if (result.isValid) {
610
+ * console.log('IP version:', result.version); // 4
611
+ * console.log('Is private:', result.isPrivate); // true
612
+ * }
613
+ * ```
614
+ */
615
+ declare function validateIp(ip: string, options?: IpOptions): IpValidationResult;
616
+ /**
617
+ * Simple IPv4 validation
618
+ *
619
+ * @param ip - IP address to validate
620
+ * @returns true if valid IPv4
621
+ */
622
+ declare function isValidIPv4(ip: string): boolean;
623
+ /**
624
+ * Simple IPv6 validation
625
+ *
626
+ * @param ip - IP address to validate
627
+ * @returns true if valid IPv6
628
+ */
629
+ declare function isValidIPv6(ip: string): boolean;
630
+ /**
631
+ * Check if IP is valid (v4 or v6)
632
+ *
633
+ * @param ip - IP address to validate
634
+ * @returns true if valid
635
+ */
636
+ declare function isValidIP(ip: string): boolean;
637
+ /**
638
+ * Check if IP is private
639
+ *
640
+ * @param ip - IP address to check
641
+ * @param version - IP version (auto-detect if not provided)
642
+ * @returns true if private
643
+ */
644
+ declare function isPrivateIp(ip: string, version?: 4 | 6): boolean;
645
+ /**
646
+ * Check if IP is loopback
647
+ *
648
+ * @param ip - IP address to check
649
+ * @param version - IP version
650
+ * @returns true if loopback
651
+ */
652
+ declare function isLoopbackIp(ip: string, version?: 4 | 6): boolean;
653
+ /**
654
+ * Get IP version
655
+ *
656
+ * @param ip - IP address
657
+ * @returns 4, 6, or null
658
+ */
659
+ declare function getIpVersion(ip: string): 4 | 6 | null;
660
+ /**
661
+ * Validate CIDR notation
662
+ *
663
+ * @param cidr - CIDR string (e.g., "192.168.1.0/24")
664
+ * @returns true if valid CIDR
665
+ */
666
+ declare function isValidCidr(cidr: string): boolean;
667
+
668
+ /**
669
+ * Financial validation module
670
+ * Includes IBAN and VAT validation
671
+ *
672
+ * @packageDocumentation
673
+ * @since 1.0.0
674
+ */
675
+
676
+ /**
677
+ * IBAN validation options
678
+ */
679
+ interface IbanOptions {
680
+ /** Custom error messages */
681
+ messages?: {
682
+ invalidFormat?: string;
683
+ invalidLength?: string;
684
+ invalidChecksum?: string;
685
+ };
686
+ }
687
+ /**
688
+ * VAT validation options
689
+ */
690
+ interface VatOptions {
691
+ /** Country code (e.g. 'GB', 'DE') */
692
+ countryCode?: string;
693
+ }
694
+ /**
695
+ * Validate International Bank Account Number (IBAN)
696
+ * Supports all SEPA and SWIFT IBAN formats
697
+ *
698
+ * @param iban - IBAN string
699
+ * @param options - Validation options
700
+ * @returns Validation result
701
+ */
702
+ declare function validateIBAN(iban: string, options?: IbanOptions): {
703
+ isValid: boolean;
704
+ errors: IValidationError[];
705
+ };
706
+ /**
707
+ * Validate VAT number (Simplified regex-based check)
708
+ *
709
+ * @param vat - VAT number
710
+ * @param options - Validation options
711
+ * @returns Validation result
712
+ */
713
+ declare function validateVAT(vat: string, options?: VatOptions): {
714
+ isValid: boolean;
715
+ errors: IValidationError[];
716
+ };
717
+
718
+ export { isValidIPv4 as $, suggestUsernames as A, validateUrl as B, isValidUrl as C, isHttpsUrl as D, type EmailOptions as E, getUrlDomain as F, normalizeUrl as G, isDataUrl as H, isDangerousUrl as I, type UrlOptions as J, type UrlValidationResult as K, validateCreditCard as L, isValidCreditCard as M, type NameOptions as N, detectCardType as O, type PhoneOptions as P, getCardTypeFromPrefix as Q, luhnCheck as R, maskCardNumber as S, formatCardNumber as T, type UserData as U, isValidCVV as V, isValidExpiry as W, type CreditCardOptions as X, type CreditCardValidationResult as Y, type CardType as Z, validateIp as _, type UserValidationOptions as a, isValidIPv6 as a0, isValidIP as a1, isPrivateIp as a2, isLoopbackIp as a3, getIpVersion as a4, isValidCidr as a5, type IpOptions as a6, type IpValidationResult as a7, validateIBAN as a8, validateVAT as a9, type IbanOptions as aa, type VatOptions as ab, type UserValidationResult as b, type NameValidationResult as c, type EmailValidationResult as d, type PhoneValidationResult as e, type UsernameOptions as f, type UsernameValidationResult as g, isDisposableEmail as h, isValidEmail as i, getEmailDomain as j, validateName as k, isValidName as l, detectScript as m, normalizeEmail as n, formatName as o, splitName as p, validatePhone as q, isValidPhone as r, sanitizeName as s, formatPhone as t, parsePhone as u, validateEmail as v, validateUsername as w, isValidUsername as x, isReservedUsername as y, sanitizeUsername as z };