@jarenjs/formats 0.8.4 → 0.34.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/src/string.js ADDED
@@ -0,0 +1,517 @@
1
+ //@ts-check
2
+
3
+ import {
4
+ isStringType,
5
+ } from '@jarenjs/core';
6
+
7
+ // The name -> predicate bindings live in ONE place: testers.js. This
8
+ // module only wraps them in the validator's compiler contract.
9
+ import { stringFormatTesters } from './testers.js';
10
+
11
+ /**
12
+ * @typedef {{format?: string, formatMinimum?: string, formatExclusiveMinimum?: string, formatMaximum?: string, formatExclusiveMaximum?: string}} JSONSchema
13
+ * @typedef {{
14
+ * options: {skipErrors: boolean},
15
+ * createErrorHandler: (expected: any, key: string, ...details: any[]) => (data: any, dataPath?: string) => boolean
16
+ * }} ValidationObject
17
+ */
18
+
19
+ /**
20
+ * Creates a string format compiler function.
21
+ *
22
+ * @param {string} formatName - The name of the format (e.g., 'email', 'uri')
23
+ * @param {(value: string) => boolean} isFormatTest - The function to test if a string matches the format
24
+ * @returns {(schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean} A compiler function that creates format validators
25
+ * @example
26
+ * const compiler = createStringFormatCompiler('email', isValidEmail);
27
+ * const validator = compiler(schemaObj, { format: 'email' });
28
+ * validator('user@example.com'); // true
29
+ */
30
+ export function createStringFormatCompiler(formatName, isFormatTest) {
31
+ return function compileStringFormat(schemaObj, jsonSchema) {
32
+ if (jsonSchema.format !== formatName)
33
+ throw new Error('Format is not equal to jsonSchema (should not happen!)');
34
+
35
+ // when skipErrors is true, we don't need to create error objects
36
+ if (schemaObj.options.skipErrors) {
37
+ return function validateStringFormatFast(data, _dataPath) {
38
+ return isStringType(data)
39
+ ? isFormatTest(data)
40
+ : true;
41
+ };
42
+ }
43
+
44
+ const addError = schemaObj.createErrorHandler(formatName, 'format', isFormatTest.constructor.name);
45
+
46
+ return function validateStringFormat(data, dataPath) {
47
+ return isStringType(data)
48
+ ? isFormatTest(data) || addError(data, dataPath)
49
+ : true;
50
+ };
51
+ };
52
+ }
53
+
54
+ // =============================================================================
55
+ // Alphabetic & Case Format Compilers
56
+ // =============================================================================
57
+
58
+ /**
59
+ * Compiles a validator for the 'alpha' format.
60
+ * Validates strings containing only alphabetic characters (a-z, A-Z).
61
+ *
62
+ * @param {ValidationObject} schemaObj - The validation object for error handling and options
63
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
64
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
65
+ * @example
66
+ * compileAlphaFormat(schemaObj, { format: 'alpha' })('HelloWorld'); // true
67
+ * compileAlphaFormat(schemaObj, { format: 'alpha' })('Hello123'); // false (with error)
68
+ */
69
+ export const compileAlphaFormat = createStringFormatCompiler('alpha', stringFormatTesters['alpha']);
70
+
71
+ /**
72
+ * Compiles a validator for the 'alphanumeric' format.
73
+ * Validates strings containing only alphabetic characters and digits (a-z, A-Z, 0-9).
74
+ *
75
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
76
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
77
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
78
+ * @example
79
+ * compileAlphaNumericFormat(schemaObj, { format: 'alphanumeric' })('Hello123'); // true
80
+ */
81
+ export const compileAlphaNumericFormat = createStringFormatCompiler('alphanumeric', stringFormatTesters['alphanumeric']);
82
+
83
+ /**
84
+ * Compiles a validator for the 'uppercase' format.
85
+ * Validates strings containing only uppercase characters.
86
+ *
87
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
88
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
89
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
90
+ */
91
+ export const compileUppercaseFormat = createStringFormatCompiler('uppercase', stringFormatTesters['uppercase']);
92
+
93
+ /**
94
+ * Compiles a validator for the 'lowercase' format.
95
+ * Validates strings containing only lowercase characters.
96
+ *
97
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
98
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
99
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
100
+ */
101
+ export const compileLowercaseFormat = createStringFormatCompiler('lowercase', stringFormatTesters['lowercase']);
102
+
103
+ // =============================================================================
104
+ // Identifier Format Compilers
105
+ // =============================================================================
106
+
107
+ /**
108
+ * Compiles a validator for the 'identifier' format.
109
+ * Validates general identifier strings (variable names, etc.).
110
+ *
111
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
112
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
113
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
114
+ */
115
+ export const compileIdentifierFormat = createStringFormatCompiler('identifier', stringFormatTesters['identifier']);
116
+
117
+ /**
118
+ * Compiles a validator for the 'html-identifier' format.
119
+ * Validates HTML element and attribute identifiers.
120
+ *
121
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
122
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
123
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
124
+ */
125
+ export const compileHtmlIdentifierFormat = createStringFormatCompiler('html-identifier', stringFormatTesters['html-identifier']);
126
+
127
+ /**
128
+ * Compiles a validator for the 'css-identifier' format.
129
+ * Validates CSS class and ID selectors.
130
+ *
131
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
132
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
133
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
134
+ */
135
+ export const compileCssIdentifierFormat = createStringFormatCompiler('css-identifier', stringFormatTesters['css-identifier']);
136
+
137
+ // =============================================================================
138
+ // Numeric & Color Format Compilers
139
+ // =============================================================================
140
+
141
+ /**
142
+ * Compiles a validator for the 'hexadecimal' format.
143
+ * Validates hexadecimal number strings (0-9, a-f, A-F).
144
+ *
145
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
146
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
147
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
148
+ */
149
+ export const compileHexadecimalFormat = createStringFormatCompiler('hexadecimal', stringFormatTesters['hexadecimal']);
150
+
151
+ /**
152
+ * Compiles a validator for the 'numeric' format.
153
+ * Validates numeric strings containing only digits.
154
+ *
155
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
156
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
157
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
158
+ */
159
+ export const compileNumericFormat = createStringFormatCompiler('numeric', stringFormatTesters['numeric']);
160
+
161
+ /**
162
+ * Compiles a validator for the 'color' format.
163
+ * Validates hexadecimal color codes (e.g., #FFF, #FFFFFF).
164
+ *
165
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
166
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
167
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
168
+ */
169
+ export const compileColorFormat = createStringFormatCompiler('color', stringFormatTesters['color']);
170
+
171
+ // =============================================================================
172
+ // Regex Format Compiler
173
+ // =============================================================================
174
+
175
+ /**
176
+ * Compiles a validator for the 'regex' format.
177
+ * Validates that a string is a valid regular expression pattern.
178
+ *
179
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
180
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
181
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
182
+ */
183
+ export const compileRegexFormat = createStringFormatCompiler('regex', stringFormatTesters['regex']);
184
+
185
+ /**
186
+ * Compiles a validator for the 'iregexp' format.
187
+ * Validates that a string is a valid I-Regexp (RFC 9485) pattern - the
188
+ * interoperable subset that carries the same meaning across regexp
189
+ * dialects. Stricter than 'regex': shorthand classes (\d, \w), lazy
190
+ * quantifiers, anchors and lookaround are all rejected.
191
+ *
192
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
193
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
194
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
195
+ */
196
+ export const compileIRegexpFormat = createStringFormatCompiler('iregexp', stringFormatTesters['iregexp']);
197
+
198
+ // =============================================================================
199
+ // URI Format Compilers
200
+ // =============================================================================
201
+
202
+ /**
203
+ * Compiles a validator for the 'uri' format.
204
+ * Validates absolute URI strings per RFC 3986.
205
+ *
206
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
207
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
208
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
209
+ * @example
210
+ * compileUriFormat(schemaObj, { format: 'uri' })('https://example.com'); // true
211
+ */
212
+ export const compileUriFormat = createStringFormatCompiler('uri', stringFormatTesters['uri']);
213
+
214
+ /**
215
+ * Compiles a validator for the 'uri-reference' format.
216
+ * Validates URI reference strings (absolute or relative) per RFC 3986.
217
+ *
218
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
219
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
220
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
221
+ */
222
+ export const compileUriReferenceFormat = createStringFormatCompiler('uri-reference', stringFormatTesters['uri-reference']);
223
+
224
+ /**
225
+ * Compiles a validator for the 'uri-template' format.
226
+ * Validates URI template strings per RFC 6570.
227
+ *
228
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
229
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
230
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
231
+ */
232
+ export const compileUriTemplateFormat = createStringFormatCompiler('uri-template', stringFormatTesters['uri-template']);
233
+
234
+ /**
235
+ * Compiles a validator for the 'url' format.
236
+ * Validates URL strings per the WHATWG URL Standard.
237
+ *
238
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
239
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
240
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
241
+ */
242
+ export const compileUrlFormat = createStringFormatCompiler('url', stringFormatTesters['url']);
243
+
244
+ // =============================================================================
245
+ // IRI Format Compilers (Internationalized Resource Identifiers)
246
+ // =============================================================================
247
+
248
+ /**
249
+ * Compiles a validator for the 'iri' format.
250
+ * Validates IRI strings per RFC 3987.
251
+ *
252
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
253
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
254
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
255
+ */
256
+ export const compileIriFormat = createStringFormatCompiler('iri', stringFormatTesters['iri']);
257
+
258
+ /**
259
+ * Compiles a validator for the 'iri-reference' format.
260
+ * Validates IRI reference strings (absolute or relative) per RFC 3987.
261
+ *
262
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
263
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
264
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
265
+ */
266
+ export const compileIriReferenceFormat = createStringFormatCompiler('iri-reference', stringFormatTesters['iri-reference']);
267
+
268
+ // =============================================================================
269
+ // Email Format Compilers
270
+ // =============================================================================
271
+
272
+ /**
273
+ * Compiles a validator for the 'email' format.
274
+ * Validates email address strings per RFC 5321.
275
+ *
276
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
277
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
278
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
279
+ * @example
280
+ * compileEmailFormat(schemaObj, { format: 'email' })('user@example.com'); // true
281
+ */
282
+ export const compileEmailFormat = createStringFormatCompiler('email', stringFormatTesters['email']);
283
+
284
+ /**
285
+ * Compiles a validator for the 'idn-email' format.
286
+ * Validates internationalized email addresses (EAI) per RFC 6531.
287
+ *
288
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
289
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
290
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
291
+ */
292
+ export const compileIdnEmailFormat = createStringFormatCompiler('idn-email', stringFormatTesters['idn-email']);
293
+
294
+ // =============================================================================
295
+ // Hostname Format Compilers
296
+ // =============================================================================
297
+
298
+ /**
299
+ * Compiles a validator for the 'hostname' format.
300
+ * Validates hostname strings per RFC 1123.
301
+ *
302
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
303
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
304
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
305
+ */
306
+ export const compileHostnameFormat = createStringFormatCompiler('hostname', stringFormatTesters['hostname']);
307
+
308
+ /**
309
+ * Compiles a validator for the 'idn-hostname' format.
310
+ * Validates internationalized domain names (IDN) per RFC 5890.
311
+ *
312
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
313
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
314
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
315
+ */
316
+ export const compileIdnHostnameFormat = createStringFormatCompiler('idn-hostname', stringFormatTesters['idn-hostname']);
317
+
318
+ // =============================================================================
319
+ // IP Address Format Compilers
320
+ // =============================================================================
321
+
322
+ /**
323
+ * Compiles a validator for the 'ipv4' format.
324
+ * Validates IPv4 address strings.
325
+ *
326
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
327
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
328
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
329
+ * @example
330
+ * compileIpv4Format(schemaObj, { format: 'ipv4' })('192.168.1.1'); // true
331
+ */
332
+ export const compileIpv4Format = createStringFormatCompiler('ipv4', stringFormatTesters['ipv4']);
333
+
334
+ /**
335
+ * Compiles a validator for the 'ipv6' format.
336
+ * Validates IPv6 address strings.
337
+ *
338
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
339
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
340
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
341
+ */
342
+ export const compileIpv6Format = createStringFormatCompiler('ipv6', stringFormatTesters['ipv6']);
343
+
344
+ // =============================================================================
345
+ // UUID & GUID Format Compilers
346
+ // =============================================================================
347
+
348
+ /**
349
+ * Compiles a validator for the 'uuid' format.
350
+ * Validates UUID strings per RFC 4122.
351
+ *
352
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
353
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
354
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
355
+ * @example
356
+ * compileUuidFormat(schemaObj, { format: 'uuid' })('550e8400-e29b-41d4-a716-446655440000'); // true
357
+ */
358
+ export const compileUuidFormat = createStringFormatCompiler('uuid', stringFormatTesters['uuid']);
359
+
360
+ /**
361
+ * Compiles a validator for the 'guid' format.
362
+ * Validates GUID strings (Microsoft format).
363
+ *
364
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
365
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
366
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
367
+ */
368
+ export const compileGuidFormat = createStringFormatCompiler('guid', stringFormatTesters['guid']);
369
+
370
+ // =============================================================================
371
+ // ISBN Format Compilers
372
+ // =============================================================================
373
+
374
+ /**
375
+ * Compiles a validator for the 'isbn10' format.
376
+ * Validates ISBN-10 identifier strings.
377
+ *
378
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
379
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
380
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
381
+ */
382
+ export const compileIsbn10Format = createStringFormatCompiler('isbn10', stringFormatTesters['isbn10']);
383
+
384
+ /**
385
+ * Compiles a validator for the 'isbn13' format.
386
+ * Validates ISBN-13 identifier strings.
387
+ *
388
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
389
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
390
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
391
+ */
392
+ export const compileIsbn13Format = createStringFormatCompiler('isbn13', stringFormatTesters['isbn13']);
393
+
394
+ // =============================================================================
395
+ // Hardware Address Format Compilers
396
+ // =============================================================================
397
+
398
+ /**
399
+ * Compiles a validator for the 'mac' format.
400
+ * Validates MAC address strings.
401
+ *
402
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
403
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
404
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
405
+ */
406
+ export const compileMacFormat = createStringFormatCompiler('mac', stringFormatTesters['mac']);
407
+
408
+ // =============================================================================
409
+ // Encoding Format Compilers
410
+ // =============================================================================
411
+
412
+ /**
413
+ * Compiles a validator for the 'base64' format.
414
+ * Validates Base64 encoded strings.
415
+ *
416
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
417
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
418
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
419
+ */
420
+ export const compileBase64Format = createStringFormatCompiler('base64', stringFormatTesters['base64']);
421
+
422
+ /**
423
+ * Compiles a validator for the 'byte' format.
424
+ * Alias for 'base64' format.
425
+ *
426
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
427
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
428
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
429
+ */
430
+ export const compileByteFormat = createStringFormatCompiler('byte', stringFormatTesters['byte']);
431
+
432
+ // =============================================================================
433
+ // Country & Banking Format Compilers
434
+ // =============================================================================
435
+
436
+ /**
437
+ * Compiles a validator for the 'country2' format.
438
+ * Validates ISO 3166-1 alpha-2 country codes.
439
+ *
440
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
441
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
442
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
443
+ * @example
444
+ * compileCountry2Format(schemaObj, { format: 'country2' })('US'); // true
445
+ * compileCountry2Format(schemaObj, { format: 'country2' })('XX'); // false (with error)
446
+ */
447
+ export const compileCountry2Format = createStringFormatCompiler('country2', stringFormatTesters['country2']);
448
+
449
+ /**
450
+ * Compiles a validator for the 'iban' format.
451
+ * Validates IBAN (International Bank Account Number) strings.
452
+ *
453
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
454
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
455
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
456
+ */
457
+ export const compileIbanFormat = createStringFormatCompiler('iban', stringFormatTesters['iban']);
458
+
459
+ // =============================================================================
460
+ // Aggregated Format Validators Object (Backward Compatibility)
461
+ // =============================================================================
462
+
463
+ /**
464
+ * Object mapping format names to their compiler functions.
465
+ * Used for backward compatibility and aggregate imports.
466
+ *
467
+ * @type {Record<string, (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean>}
468
+ */
469
+ export const formatValidators = {
470
+ // Alphabetic & Case
471
+ 'alpha': compileAlphaFormat,
472
+ 'alphanumeric': compileAlphaNumericFormat,
473
+ 'uppercase': compileUppercaseFormat,
474
+ 'lowercase': compileLowercaseFormat,
475
+ // Identifiers
476
+ 'identifier': compileIdentifierFormat,
477
+ 'html-identifier': compileHtmlIdentifierFormat,
478
+ 'css-identifier': compileCssIdentifierFormat,
479
+ // Numeric & Color
480
+ 'hexadecimal': compileHexadecimalFormat,
481
+ 'numeric': compileNumericFormat,
482
+ 'color': compileColorFormat,
483
+ // Regex
484
+ 'regex': compileRegexFormat,
485
+ 'iregexp': compileIRegexpFormat,
486
+ // URI
487
+ 'uri': compileUriFormat,
488
+ 'uri-reference': compileUriReferenceFormat,
489
+ 'uri-template': compileUriTemplateFormat,
490
+ 'url': compileUrlFormat,
491
+ // IRI
492
+ 'iri': compileIriFormat,
493
+ 'iri-reference': compileIriReferenceFormat,
494
+ // Email
495
+ 'email': compileEmailFormat,
496
+ 'idn-email': compileIdnEmailFormat,
497
+ // Hostname
498
+ 'hostname': compileHostnameFormat,
499
+ 'idn-hostname': compileIdnHostnameFormat,
500
+ // IP Address
501
+ 'ipv4': compileIpv4Format,
502
+ 'ipv6': compileIpv6Format,
503
+ // UUID & GUID
504
+ 'uuid': compileUuidFormat,
505
+ 'guid': compileGuidFormat,
506
+ // ISBN
507
+ 'isbn10': compileIsbn10Format,
508
+ 'isbn13': compileIsbn13Format,
509
+ // Hardware Address
510
+ 'mac': compileMacFormat,
511
+ // Encoding
512
+ 'base64': compileBase64Format,
513
+ 'byte': compileByteFormat,
514
+ // Country & Banking
515
+ 'country2': compileCountry2Format,
516
+ 'iban': compileIbanFormat,
517
+ };