@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.
@@ -0,0 +1,355 @@
1
+ export type JSONSchema = {
2
+ format?: string;
3
+ formatMinimum?: string;
4
+ formatExclusiveMinimum?: string;
5
+ formatMaximum?: string;
6
+ formatExclusiveMaximum?: string;
7
+ };
8
+ export type ValidationObject = {
9
+ options: {
10
+ skipErrors: boolean;
11
+ };
12
+ createErrorHandler: (expected: any, key: string, ...details: any[]) => (data: any, dataPath?: string) => boolean;
13
+ };
14
+ /**
15
+ * @typedef {{format?: string, formatMinimum?: string, formatExclusiveMinimum?: string, formatMaximum?: string, formatExclusiveMaximum?: string}} JSONSchema
16
+ * @typedef {{
17
+ * options: {skipErrors: boolean},
18
+ * createErrorHandler: (expected: any, key: string, ...details: any[]) => (data: any, dataPath?: string) => boolean
19
+ * }} ValidationObject
20
+ */
21
+ /**
22
+ * Creates a string format compiler function.
23
+ *
24
+ * @param {string} formatName - The name of the format (e.g., 'email', 'uri')
25
+ * @param {(value: string) => boolean} isFormatTest - The function to test if a string matches the format
26
+ * @returns {(schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean} A compiler function that creates format validators
27
+ * @example
28
+ * const compiler = createStringFormatCompiler('email', isValidEmail);
29
+ * const validator = compiler(schemaObj, { format: 'email' });
30
+ * validator('user@example.com'); // true
31
+ */
32
+ export declare function createStringFormatCompiler(formatName: string, isFormatTest: (value: string) => boolean): (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
33
+ /**
34
+ * Compiles a validator for the 'alpha' format.
35
+ * Validates strings containing only alphabetic characters (a-z, A-Z).
36
+ *
37
+ * @param {ValidationObject} schemaObj - The validation object for error handling and options
38
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
39
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
40
+ * @example
41
+ * compileAlphaFormat(schemaObj, { format: 'alpha' })('HelloWorld'); // true
42
+ * compileAlphaFormat(schemaObj, { format: 'alpha' })('Hello123'); // false (with error)
43
+ */
44
+ export declare const compileAlphaFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
45
+ /**
46
+ * Compiles a validator for the 'alphanumeric' format.
47
+ * Validates strings containing only alphabetic characters and digits (a-z, A-Z, 0-9).
48
+ *
49
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
50
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
51
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
52
+ * @example
53
+ * compileAlphaNumericFormat(schemaObj, { format: 'alphanumeric' })('Hello123'); // true
54
+ */
55
+ export declare const compileAlphaNumericFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
56
+ /**
57
+ * Compiles a validator for the 'uppercase' format.
58
+ * Validates strings containing only uppercase characters.
59
+ *
60
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
61
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
62
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
63
+ */
64
+ export declare const compileUppercaseFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
65
+ /**
66
+ * Compiles a validator for the 'lowercase' format.
67
+ * Validates strings containing only lowercase characters.
68
+ *
69
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
70
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
71
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
72
+ */
73
+ export declare const compileLowercaseFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
74
+ /**
75
+ * Compiles a validator for the 'identifier' format.
76
+ * Validates general identifier strings (variable names, etc.).
77
+ *
78
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
79
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
80
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
81
+ */
82
+ export declare const compileIdentifierFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
83
+ /**
84
+ * Compiles a validator for the 'html-identifier' format.
85
+ * Validates HTML element and attribute identifiers.
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 declare const compileHtmlIdentifierFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
92
+ /**
93
+ * Compiles a validator for the 'css-identifier' format.
94
+ * Validates CSS class and ID selectors.
95
+ *
96
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
97
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
98
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
99
+ */
100
+ export declare const compileCssIdentifierFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
101
+ /**
102
+ * Compiles a validator for the 'hexadecimal' format.
103
+ * Validates hexadecimal number strings (0-9, a-f, A-F).
104
+ *
105
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
106
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
107
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
108
+ */
109
+ export declare const compileHexadecimalFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
110
+ /**
111
+ * Compiles a validator for the 'numeric' format.
112
+ * Validates numeric strings containing only digits.
113
+ *
114
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
115
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
116
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
117
+ */
118
+ export declare const compileNumericFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
119
+ /**
120
+ * Compiles a validator for the 'color' format.
121
+ * Validates hexadecimal color codes (e.g., #FFF, #FFFFFF).
122
+ *
123
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
124
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
125
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
126
+ */
127
+ export declare const compileColorFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
128
+ /**
129
+ * Compiles a validator for the 'regex' format.
130
+ * Validates that a string is a valid regular expression pattern.
131
+ *
132
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
133
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
134
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
135
+ */
136
+ export declare const compileRegexFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
137
+ /**
138
+ * Compiles a validator for the 'iregexp' format.
139
+ * Validates that a string is a valid I-Regexp (RFC 9485) pattern - the
140
+ * interoperable subset that carries the same meaning across regexp
141
+ * dialects. Stricter than 'regex': shorthand classes (\d, \w), lazy
142
+ * quantifiers, anchors and lookaround are all rejected.
143
+ *
144
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
145
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
146
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
147
+ */
148
+ export declare const compileIRegexpFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
149
+ /**
150
+ * Compiles a validator for the 'uri' format.
151
+ * Validates absolute URI strings per RFC 3986.
152
+ *
153
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
154
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
155
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
156
+ * @example
157
+ * compileUriFormat(schemaObj, { format: 'uri' })('https://example.com'); // true
158
+ */
159
+ export declare const compileUriFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
160
+ /**
161
+ * Compiles a validator for the 'uri-reference' format.
162
+ * Validates URI reference strings (absolute or relative) per RFC 3986.
163
+ *
164
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
165
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
166
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
167
+ */
168
+ export declare const compileUriReferenceFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
169
+ /**
170
+ * Compiles a validator for the 'uri-template' format.
171
+ * Validates URI template strings per RFC 6570.
172
+ *
173
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
174
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
175
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
176
+ */
177
+ export declare const compileUriTemplateFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
178
+ /**
179
+ * Compiles a validator for the 'url' format.
180
+ * Validates URL strings per the WHATWG URL Standard.
181
+ *
182
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
183
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
184
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
185
+ */
186
+ export declare const compileUrlFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
187
+ /**
188
+ * Compiles a validator for the 'iri' format.
189
+ * Validates IRI strings per RFC 3987.
190
+ *
191
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
192
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
193
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
194
+ */
195
+ export declare const compileIriFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
196
+ /**
197
+ * Compiles a validator for the 'iri-reference' format.
198
+ * Validates IRI reference strings (absolute or relative) per RFC 3987.
199
+ *
200
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
201
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
202
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
203
+ */
204
+ export declare const compileIriReferenceFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
205
+ /**
206
+ * Compiles a validator for the 'email' format.
207
+ * Validates email address strings per RFC 5321.
208
+ *
209
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
210
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
211
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
212
+ * @example
213
+ * compileEmailFormat(schemaObj, { format: 'email' })('user@example.com'); // true
214
+ */
215
+ export declare const compileEmailFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
216
+ /**
217
+ * Compiles a validator for the 'idn-email' format.
218
+ * Validates internationalized email addresses (EAI) per RFC 6531.
219
+ *
220
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
221
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
222
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
223
+ */
224
+ export declare const compileIdnEmailFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
225
+ /**
226
+ * Compiles a validator for the 'hostname' format.
227
+ * Validates hostname strings per RFC 1123.
228
+ *
229
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
230
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
231
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
232
+ */
233
+ export declare const compileHostnameFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
234
+ /**
235
+ * Compiles a validator for the 'idn-hostname' format.
236
+ * Validates internationalized domain names (IDN) per RFC 5890.
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 declare const compileIdnHostnameFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
243
+ /**
244
+ * Compiles a validator for the 'ipv4' format.
245
+ * Validates IPv4 address strings.
246
+ *
247
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
248
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
249
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
250
+ * @example
251
+ * compileIpv4Format(schemaObj, { format: 'ipv4' })('192.168.1.1'); // true
252
+ */
253
+ export declare const compileIpv4Format: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
254
+ /**
255
+ * Compiles a validator for the 'ipv6' format.
256
+ * Validates IPv6 address strings.
257
+ *
258
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
259
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
260
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
261
+ */
262
+ export declare const compileIpv6Format: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
263
+ /**
264
+ * Compiles a validator for the 'uuid' format.
265
+ * Validates UUID strings per RFC 4122.
266
+ *
267
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
268
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
269
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
270
+ * @example
271
+ * compileUuidFormat(schemaObj, { format: 'uuid' })('550e8400-e29b-41d4-a716-446655440000'); // true
272
+ */
273
+ export declare const compileUuidFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
274
+ /**
275
+ * Compiles a validator for the 'guid' format.
276
+ * Validates GUID strings (Microsoft format).
277
+ *
278
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
279
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
280
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
281
+ */
282
+ export declare const compileGuidFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
283
+ /**
284
+ * Compiles a validator for the 'isbn10' format.
285
+ * Validates ISBN-10 identifier strings.
286
+ *
287
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
288
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
289
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
290
+ */
291
+ export declare const compileIsbn10Format: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
292
+ /**
293
+ * Compiles a validator for the 'isbn13' format.
294
+ * Validates ISBN-13 identifier strings.
295
+ *
296
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
297
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
298
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
299
+ */
300
+ export declare const compileIsbn13Format: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
301
+ /**
302
+ * Compiles a validator for the 'mac' format.
303
+ * Validates MAC address strings.
304
+ *
305
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
306
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
307
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
308
+ */
309
+ export declare const compileMacFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
310
+ /**
311
+ * Compiles a validator for the 'base64' format.
312
+ * Validates Base64 encoded strings.
313
+ *
314
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
315
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
316
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
317
+ */
318
+ export declare const compileBase64Format: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
319
+ /**
320
+ * Compiles a validator for the 'byte' format.
321
+ * Alias for 'base64' format.
322
+ *
323
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
324
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
325
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
326
+ */
327
+ export declare const compileByteFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
328
+ /**
329
+ * Compiles a validator for the 'country2' format.
330
+ * Validates ISO 3166-1 alpha-2 country codes.
331
+ *
332
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
333
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
334
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
335
+ * @example
336
+ * compileCountry2Format(schemaObj, { format: 'country2' })('US'); // true
337
+ * compileCountry2Format(schemaObj, { format: 'country2' })('XX'); // false (with error)
338
+ */
339
+ export declare const compileCountry2Format: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
340
+ /**
341
+ * Compiles a validator for the 'iban' format.
342
+ * Validates IBAN (International Bank Account Number) strings.
343
+ *
344
+ * @param {ValidationObject} schemaObj - The validation JSONSchema for error handling and options
345
+ * @param {JSONSchema} jsonSchema - The JSON schema containing the format definition
346
+ * @returns {(data: unknown, dataPath?: string) => boolean} A validator function
347
+ */
348
+ export declare const compileIbanFormat: (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean;
349
+ /**
350
+ * Object mapping format names to their compiler functions.
351
+ * Used for backward compatibility and aggregate imports.
352
+ *
353
+ * @type {Record<string, (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean>}
354
+ */
355
+ export declare const formatValidators: Record<string, (schemaObj: ValidationObject, jsonSchema: JSONSchema) => (data: unknown, dataPath?: string) => boolean>;
@@ -0,0 +1,39 @@
1
+ export type StringFormatTester = (value: string) => boolean;
2
+ export type NumberFormatTester = (value: number) => boolean;
3
+ /** @typedef {(value: string) => boolean} StringFormatTester */
4
+ /** @typedef {(value: number) => boolean} NumberFormatTester */
5
+ /**
6
+ * String format testers (the string.js compiler group).
7
+ * @type {Record<string, StringFormatTester>}
8
+ */
9
+ export declare const stringFormatTesters: Record<string, StringFormatTester>;
10
+ /**
11
+ * JSON addressing format testers (the json.js compiler group).
12
+ * @type {Record<string, StringFormatTester>}
13
+ */
14
+ export declare const jsonFormatTesters: Record<string, StringFormatTester>;
15
+ /**
16
+ * Date and time format testers - the boolean twins of the parse-based
17
+ * compilers in datetime.js.
18
+ * @type {Record<string, StringFormatTester>}
19
+ */
20
+ export declare const dateTimeFormatTesters: Record<string, StringFormatTester>;
21
+ /**
22
+ * Geospatial format testers (the geo.js compiler group). `geohash` and
23
+ * `wkt` take strings; `geojson` takes the OBJECT value — the quick
24
+ * yes-or-no twin of the GeoJSON meta-schema artifacts in `@jarenjs/json`,
25
+ * including the ring-closure invariant JSON Schema cannot express.
26
+ * @type {Record<string, (value: any) => boolean>}
27
+ */
28
+ export declare const geoFormatTesters: Record<string, (value: any) => boolean>;
29
+ /**
30
+ * Number format testers (the number.js compiler group). These take the
31
+ * NUMBER value, not a string.
32
+ * @type {Record<string, NumberFormatTester>}
33
+ */
34
+ export declare const numberFormatTesters: Record<string, NumberFormatTester>;
35
+ /**
36
+ * Every format tester this package knows, in one flat registry.
37
+ * @type {Record<string, (value: any) => boolean>}
38
+ */
39
+ export declare const formatTesters: Record<string, (value: any) => boolean>;
package/package.json CHANGED
@@ -1,29 +1,49 @@
1
1
  {
2
2
  "name": "@jarenjs/formats",
3
3
  "private": false,
4
- "version": "0.8.4",
4
+ "version": "0.34.0",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
6
+ "main": "./src/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "default": "./src/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
7
16
  "files": [
8
- "dist"
17
+ "dist/types/",
18
+ "src/"
9
19
  ],
10
20
  "description": "Jaren Formats for JSON Schema Validation",
11
21
  "author": "joham",
12
22
  "repository": {
13
23
  "type": "git",
14
- "url": "https://github.com/jklarenbeek/jarenjs.git",
24
+ "url": "git+https://github.com/jklarenbeek/jarenjs.git",
15
25
  "directory": "packages/formats"
16
26
  },
17
27
  "license": "MIT",
28
+ "engines": {
29
+ "node": ">=24"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "registry": "https://registry.npmjs.org/"
34
+ },
18
35
  "keywords": [
19
36
  "jaren",
20
- "json schema",
37
+ "json-schema",
21
38
  "formats"
22
39
  ],
23
40
  "scripts": {
24
- "build": "node esbuild.config.js"
41
+ "build": "node esbuild.config.js && npm run build:types",
42
+ "build:types": "tsc -p tsconfig.json",
43
+ "prepack": "npm run build:types"
25
44
  },
26
- "devDependencies": {
27
- "esbuild": "^0.23.1"
45
+ "dependencies": {
46
+ "@jarenjs/core": "^0.34.0",
47
+ "@jarenjs/json": "^0.34.0"
28
48
  }
29
49
  }