typia 5.3.12-dev.20240119 → 5.3.12-dev.20240121

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/json.ts CHANGED
@@ -1,724 +1,724 @@
1
- import * as Namespace from "./functional/Namespace";
2
-
3
- import { IJsonApplication } from "./schemas/json/IJsonApplication";
4
-
5
- import { IValidation } from "./IValidation";
6
- import { Primitive } from "./Primitive";
7
-
8
- /* ===========================================================
9
- JSON
10
- - SCHEMA
11
- - PARSE
12
- - STRINGIFY
13
- - FACTORY FUNCTIONS
14
- ==============================================================
15
- SCHEMA
16
- ----------------------------------------------------------- */
17
- /**
18
- * > You must configure the generic argument `Types`.
19
- *
20
- * JSON Schema Application.
21
- *
22
- * Creates a JSON schema application which contains both main JSON schemas and
23
- * components. Note that, all of the named types are stored in the
24
- * {@link IJsonApplication.components} property for the `$ref` referencing.
25
- *
26
- * Also, `typia.json.application()` has two additional generic arguments.
27
- *
28
- * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
29
- * For an example, `ajv` has an extra property "$recursiveRef" that are not
30
- * exists in the standard JSON schema definition spec. Otherwise, `swagger`
31
- * can't identify the tuple definition.
32
- *
33
- * The next *Surplus* means whether to allow surplus properties starting with
34
- * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
35
- * would be registered into the JSON schema, otherwise, not.
36
- *
37
- * @template Types Tuple of target types
38
- * @template Purpose Purpose of the JSON schema
39
- * @template Surplus Allow surplus properties starting with `x-typia-` or not
40
- * @return JSON schema application
41
- *
42
- * @author Jeongho Nam - https://github.com/samchon
43
- */
44
- export function application(): never;
45
-
46
- /**
47
- * JSON Schema Application.
48
- *
49
- * Creates a JSON schema application which contains both main JSON schemas and
50
- * components. Note that, all of the named types are stored in the
51
- * {@link IJsonApplication.components} property for the `$ref` referencing.
52
- *
53
- * Also, `typia.json.application()` has two additional generic arguments.
54
- *
55
- * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
56
- * For an example, `ajv` has an extra property "$recursiveRef" that are not
57
- * exists in the standard JSON schema definition spec. Otherwise, `swagger`
58
- * can't identify the tuple definition.
59
- *
60
- * The next *Surplus* means whether to allow surplus properties starting with
61
- * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
62
- * would be registered into the JSON schema, otherwise, not.
63
- *
64
- * @template Types Tuple of target types
65
- * @template Purpose Purpose of the JSON schema
66
- * @template Surplus Allow surplus properties starting with `x-typia-` or not
67
- * @return JSON schema application
68
- *
69
- * @author Jeongho Nam - https://github.com/samchon
70
- */
71
- export function application<
72
- Types extends unknown[],
73
- Purpose extends "ajv" | "swagger" = "swagger",
74
- Surplus extends boolean = false,
75
- >(): IJsonApplication;
76
-
77
- /**
78
- * @internal
79
- */
80
- export function application(): never {
81
- halt("application");
82
- }
83
-
84
- /* -----------------------------------------------------------
85
- PARSE
86
- ----------------------------------------------------------- */
87
- /**
88
- * > You must configure the generic argument `T`.
89
- *
90
- * Safe `JSON.parse()` function with type assertion.
91
- *
92
- * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
93
- * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
94
- * to a `T` typed instance with type assertion.
95
- *
96
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
97
- * throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed value,
98
- * the parsed value would be returned.
99
- *
100
- * @template T Expected type of parsed value
101
- * @param input JSON string
102
- * @returns Parsed value
103
- *
104
- * @author Jeongho Nam - https://github.com/samchon
105
- */
106
- function assertParse(input: string): never;
107
-
108
- /**
109
- * Safe `JSON.parse()` function with type assertion.
110
- *
111
- * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
112
- * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
113
- * to a `T` typed instance with type assertion.
114
- *
115
- * In such reason, when parsed JSON string value is not matched with the type `T`,
116
- * it throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed
117
- * value, the parsed value would be returned.
118
- *
119
- * @template T Expected type of parsed value
120
- * @param input JSON string
121
- * @returns Parsed value
122
- *
123
- * @author Jeongho Nam - https://github.com/samchon
124
- */
125
- function assertParse<T>(input: string): Primitive<T>;
126
-
127
- /**
128
- * @internal
129
- */
130
- function assertParse<T>(): Primitive<T> {
131
- halt("assertParse");
132
- }
133
- const assertParsePure = /** @__PURE__ */ Object.assign<typeof assertParse, {}>(
134
- assertParse,
135
- /** @__PURE__ */ Namespace.assert("json.assertParse"),
136
- );
137
- export { assertParsePure as assertParse };
138
-
139
- /**
140
- * > You must configure the generic argument `T`.
141
- *
142
- * Safe `JSON.parse()` function with type checking.
143
- *
144
- * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
145
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
146
- * instance with type checking.
147
- *
148
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
149
- * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
150
- * value would be returned.
151
- *
152
- * @template T Expected type of parsed value
153
- * @param input JSON string
154
- * @returns Parsed value when exact type, otherwise `null`
155
- *
156
- * @author Jeongho Nam - https://github.com/samchon
157
- */
158
- function isParse(input: string): never;
159
-
160
- /**
161
- * Safe `JSON.parse()` function with type checking.
162
- *
163
- * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
164
- * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
165
- * instance with type checking.
166
- *
167
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
168
- * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
169
- * value would be returned.
170
- *
171
- * @template T Expected type of parsed value
172
- * @param input JSON string
173
- * @returns Parsed value when exact type, otherwise `null`
174
- *
175
- * @author Jeongho Nam - https://github.com/samchon
176
- */
177
- function isParse<T>(input: string): Primitive<T> | null;
178
-
179
- /**
180
- * @internal
181
- */
182
- function isParse<T>(): Primitive<T> | null {
183
- halt("isParse");
184
- }
185
- const isParsePure = /** @__PURE__ */ Object.assign<typeof isParse, {}>(
186
- isParse,
187
- /** @__PURE__ */ Namespace.is(),
188
- );
189
- export { isParsePure as isParse };
190
-
191
- /**
192
- * > You must configure the generic argument `T`.
193
- *
194
- * Safe `JSON.parse()` function with detailed type validation.
195
- *
196
- * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
197
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
198
- * to a `T` typed instance with detailed type validation.
199
- *
200
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
201
- * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
202
- * there's no problem on the parsed value, the parsed value would be stored in `data`
203
- * property of the output {@link IValidation.ISuccess} instance.
204
- *
205
- * @template T Expected type of parsed value
206
- * @param input JSON string
207
- * @returns Validation result with JSON parsed value
208
- *
209
- * @author Jeongho Nam - https://github.com/samchon
210
- */
211
- function validateParse(input: string): never;
212
-
213
- /**
214
- * Safe `JSON.parse()` function with detailed type validation.
215
- *
216
- * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
217
- * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
218
- * to a `T` typed instance with detailed type validation.
219
- *
220
- * In such reason, when parsed JSON string value is not matched with the type `T`, it
221
- * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
222
- * there's no problem on the parsed value, the parsed value would be stored in `data`
223
- * property of the output {@link IValidation.ISuccess} instance.
224
- *
225
- * @template T Expected type of parsed value
226
- * @param input JSON string
227
- * @returns Validation result with JSON parsed value
228
- *
229
- * @author Jeongho Nam - https://github.com/samchon
230
- */
231
- function validateParse<T>(input: string): IValidation<Primitive<T>>;
232
-
233
- /**
234
- * @internal
235
- */
236
- function validateParse<T>(): IValidation<Primitive<T>> {
237
- halt("validateParse");
238
- }
239
- const validateParsePure = /** @__PURE__ */ Object.assign<
240
- typeof validateParse,
241
- {}
242
- >(validateParse, /** @__PURE__ */ Namespace.validate());
243
- export { validateParsePure as validateParse };
244
-
245
- /* -----------------------------------------------------------
246
- STRINGIFY
247
- ----------------------------------------------------------- */
248
- /**
249
- * 8x faster `JSON.stringify()` function.
250
- *
251
- * Converts an input value to a JSON (JavaScript Object Notation) string, about 8x
252
- * faster than the native `JSON.stringify()` function. The 5x faster principle is
253
- * because it writes an optimized JSON conversion plan, only for the type `T`.
254
- *
255
- * For reference, this `typia.json.stringify()` does not validate the input value type.
256
- * It just believes that the input value is following the type `T`. Therefore, if you
257
- * can't ensure the input value type, it would be better to call one of below
258
- * functions instead.
259
- *
260
- * - {@link assertStringify}
261
- * - {@link isStringify}
262
- * - {@link validateStringify}
263
- *
264
- * @template T Type of the input value
265
- * @param input A value to be converted
266
- * @return JSON string value
267
- *
268
- * @author Jeongho Nam - https://github.com/samchon
269
- */
270
- function stringify<T>(input: T): string;
271
-
272
- /**
273
- * @internal
274
- */
275
- function stringify(): never {
276
- halt("stringify");
277
- }
278
- const stringifyPure = /** @__PURE__ */ Object.assign<typeof stringify, {}>(
279
- stringify,
280
- /** @__PURE__ */ Namespace.json.stringify("stringify"),
281
- );
282
- export { stringifyPure as stringify };
283
-
284
- /**
285
- * 5x faster `JSON.stringify()` function with type assertion.
286
- *
287
- * `typia.json.assertStringify()` is a combination function of {@link assert} and
288
- * {@link stringify}. Therefore, it converts an input value to
289
- * JSON (JavaScript Object Notation) string, with type assertion.
290
- *
291
- * In such reason, when `input` value is not matched with the type `T`, it throws an
292
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
293
- * string would be returned.
294
- *
295
- * For reference, with type assertion, it is even 5x times faster than the native
296
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
297
- * with confidence.
298
- *
299
- * @template T Type of the input value
300
- * @param input A value to be asserted and converted
301
- * @return JSON string value
302
- *
303
- * @author Jeongho Nam - https://github.com/samchon
304
- */
305
- function assertStringify<T>(input: T): string;
306
-
307
- /**
308
- * 5x faster `JSON.stringify()` function with type assertion.
309
- *
310
- * `typia.json.assertStringify()` is a combination function of {@link assert} and
311
- * {@link stringify}. Therefore, it converts an input value to
312
- * JSON (JavaScript Object Notation) string, with type assertion.
313
- *
314
- * In such reason, when `input` value is not matched with the type `T`, it throws an
315
- * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
316
- * string would be returned.
317
- *
318
- * For reference, with type assertion, it is even 5x times faster than the native
319
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
320
- * with confidence.
321
- *
322
- * @template T Type of the input value
323
- * @param input A value to be asserted and converted
324
- * @return JSON string value
325
- *
326
- * @author Jeongho Nam - https://github.com/samchon
327
- */
328
- function assertStringify<T>(input: T): unknown;
329
-
330
- /**
331
- * @internal
332
- */
333
- function assertStringify(): string {
334
- halt("assertStringify");
335
- }
336
- const assertStringifyPure = /** @__PURE__ */ Object.assign<
337
- typeof assertStringify,
338
- {},
339
- {}
340
- >(
341
- assertStringify,
342
- /** @__PURE__ */ Namespace.assert("json.assertStringify"),
343
- /** @__PURE__ */ Namespace.json.stringify("assertStringify"),
344
- );
345
- export { assertStringifyPure as assertStringify };
346
-
347
- /**
348
- * 7x faster `JSON.stringify()` function with type checking.
349
- *
350
- * `typia.json.stringify()` is a combination function of {@link is} and
351
- * {@link stringify}. Therefore, it converts an input value to JSON
352
- * (JavaScript Object Notation) string, with type checking.
353
- *
354
- * In such reason, when `input` value is not matched with the type `T`, it returns
355
- * `null` value. Otherwise, there's no problem on the `input` value, JSON string
356
- * would be returned.
357
- *
358
- * For reference, with type checking, it is even 7x times faster than the native
359
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
360
- * with confidence.
361
- *
362
- * @template T Type of the input value
363
- * @param input A value to be checked and converted
364
- * @return JSON string value when exact type, otherwise null
365
- *
366
- * @author Jeongho Nam - https://github.com/samchon
367
- */
368
- function isStringify<T>(input: T): string | null;
369
-
370
- /**
371
- * 7x faster `JSON.stringify()` function with type checking.
372
- *
373
- * `typia.json.isStringify()` is a combination function of {@link is} and
374
- * {@link stringify}. Therefore, it converts an input value to JSON
375
- * (JavaScript Object Notation) string, with type checking.
376
- *
377
- * In such reason, when `input` value is not matched with the type `T`, it returns
378
- * `null` value. Otherwise, there's no problem on the `input` value, JSON string
379
- * would be returned.
380
- *
381
- * For reference, with type checking, it is even 7x times faster than the native
382
- * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
383
- * with confidence.
384
- *
385
- * @template T Type of the input value
386
- * @param input A value to be checked and converted
387
- * @return JSON string value when exact type, otherwise null
388
- *
389
- * @author Jeongho Nam - https://github.com/samchon
390
- */
391
- function isStringify<T>(input: unknown): string | null;
392
-
393
- /**
394
- * @internal
395
- */
396
- function isStringify(): string | null {
397
- halt("isStringify");
398
- }
399
-
400
- const isStringifyPure = /** @__PURE__ */ Object.assign<
401
- typeof isStringify,
402
- {},
403
- {}
404
- >(
405
- isStringify,
406
- /** @__PURE__ */ Namespace.is(),
407
- /** @__PURE__ */ Namespace.json.stringify("isStringify"),
408
- );
409
- export { isStringifyPure as isStringify };
410
-
411
- /**
412
- * 5x faster `JSON.stringify()` function with detailed type validation.
413
- *
414
- * `typia.json.validateStringify()` is a combination function of {@link validate} and
415
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
416
- * Notation) string, with detailed type validation.
417
- *
418
- * In such reason, when `input` value is not matched with the type `T`, it returns
419
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
420
- * there's no problem on the `input` value, JSON string would be stored in `data`
421
- * property of the output {@link IValidation.ISuccess} instance.
422
- *
423
- * For reference, with detailed type validation, it is even 5x times faster than the
424
- * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
425
- * conversion with confidence.
426
- *
427
- * @template T Type of the input value
428
- * @param input A value to be checked and converted
429
- * @returns Validation result with JSON string value
430
- *
431
- * @author Jeongho Nam - https://github.com/samchon
432
- */
433
- function validateStringify<T>(input: T): IValidation<string>;
434
-
435
- /**
436
- * 5x faster `JSON.stringify()` function with detailed type validation.
437
- *
438
- * `typia.json.validateStringify()` is a combination function of {@link validate} and
439
- * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
440
- * Notation) string, with detailed type validation.
441
- *
442
- * In such reason, when `input` value is not matched with the type `T`, it returns
443
- * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
444
- * there's no problem on the `input` value, JSON string would be stored in `data`
445
- * property of the output {@link IValidation.ISuccess} instance.
446
- *
447
- * For reference, with detailed type validation, it is even 5x times faster than the
448
- * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
449
- * conversion with confidence.
450
- *
451
- * @template T Type of the input value
452
- * @param input A value to be checked and converted
453
- * @returns Validation result with JSON string value
454
- *
455
- * @author Jeongho Nam - https://github.com/samchon
456
- */
457
- function validateStringify<T>(input: unknown): IValidation<string>;
458
-
459
- /**
460
- * @internal
461
- */
462
- function validateStringify(): IValidation<string> {
463
- halt("validateStringify");
464
- }
465
- const validateStringifyPure = /** @__PURE__ */ Object.assign<
466
- typeof validateStringify,
467
- {},
468
- {}
469
- >(
470
- validateStringify,
471
- /** @__PURE__ */ Namespace.validate(),
472
- /** @__PURE__ */ Namespace.json.stringify("validateStringify"),
473
- );
474
- export { validateStringifyPure as validateStringify };
475
-
476
- /* -----------------------------------------------------------
477
- FACTORY FUNCTIONS
478
- ----------------------------------------------------------- */
479
- /**
480
- * Creates a reusable {@link isParse} function.
481
- *
482
- * @danger You must configure the generic argument `T`
483
- * @returns Nothing until you configure the generic argument `T`
484
- * @throws compile error
485
- *
486
- * @author Jeongho Nam - https://github.com/samchon
487
- */
488
- function createIsParse(): never;
489
-
490
- /**
491
- * Creates a reusable {@link isParse} function.
492
- *
493
- * @template T Expected type of parsed value
494
- * @returns A reusable `isParse` function
495
- *
496
- * @author Jeongho Nam - https://github.com/samchon
497
- */
498
- function createIsParse<T>(): (input: string) => Primitive<T> | null;
499
-
500
- /**
501
- * @internal
502
- */
503
- function createIsParse<T>(): (input: string) => Primitive<T> | null {
504
- halt("createIsParse");
505
- }
506
- const createIsParsePure = /** @__PURE__ */ Object.assign<
507
- typeof createIsParse,
508
- {}
509
- >(createIsParse, isParse);
510
- export { createIsParsePure as createIsParse };
511
-
512
- /**
513
- * Creates a reusable {@link assertParse} function.
514
- *
515
- * @danger You must configure the generic argument `T`
516
- * @returns Nothing until you configure the generic argument `T`
517
- * @throws compile error
518
- *
519
- * @author Jeongho Nam - https://github.com/samchon
520
- */
521
- function createAssertParse(): never;
522
-
523
- /**
524
- * Creates a reusable {@link assertParse} function.
525
- *
526
- * @template T Expected type of parsed value
527
- * @returns A reusable `assertParse` function
528
- *
529
- * @author Jeongho Nam - https://github.com/samchon
530
- */
531
- function createAssertParse<T>(): (input: string) => Primitive<T>;
532
-
533
- /**
534
- * @internal
535
- */
536
- function createAssertParse<T>(): (input: string) => Primitive<T> {
537
- halt("createAssertParse");
538
- }
539
- const createAssertParsePure = /** @__PURE__ */ Object.assign<
540
- typeof createAssertParse,
541
- {}
542
- >(createAssertParse, assertParse);
543
- export { createAssertParsePure as createAssertParse };
544
-
545
- /**
546
- * Creates a reusable {@link validateParse} function.
547
- *
548
- * @danger You must configure the generic argument `T`
549
- * @returns Nothing until you configure the generic argument `T`
550
- * @throws compile error
551
- *
552
- * @author Jeongho Nam - https://github.com/samchon
553
- */
554
- function createValidateParse(): never;
555
-
556
- /**
557
- * Creates a reusable {@link validateParse} function.
558
- *
559
- * @template T Expected type of parsed value
560
- * @returns A reusable `validateParse` function
561
- *
562
- * @author Jeongho Nam - https://github.com/samchon
563
- */
564
- function createValidateParse<T>(): (input: string) => IValidation<Primitive<T>>;
565
-
566
- /**
567
- * @internal
568
- */
569
- function createValidateParse<T>(): (
570
- input: string,
571
- ) => IValidation<Primitive<T>> {
572
- halt("createValidateParse");
573
- }
574
-
575
- const createValidateParsePure = /** @__PURE__ */ Object.assign<
576
- typeof createValidateParse,
577
- {}
578
- >(createValidateParse, validateParse);
579
- export { createValidateParsePure as createValidateParse };
580
-
581
- /**
582
- * Creates a reusable {@link stringify} function.
583
- *
584
- * @danger You must configure the generic argument `T`
585
- * @returns Nothing until you configure the generic argument `T`
586
- * @throws compile error
587
- *
588
- * @author Jeongho Nam - https://github.com/samchon
589
- */
590
- function createStringify(): never;
591
-
592
- /**
593
- * Creates a reusable {@link stringify} function.
594
- *
595
- * @template T Type of the input value
596
- * @returns A reusable `stringify` function
597
- *
598
- * @author Jeongho Nam - https://github.com/samchon
599
- */
600
- function createStringify<T>(): (input: T) => string;
601
-
602
- /**
603
- * @internal
604
- */
605
- function createStringify<T>(): (input: T) => string {
606
- halt("createStringify");
607
- }
608
-
609
- const createStringifyPure = /** @__PURE__ */ Object.assign<
610
- typeof createStringify,
611
- {}
612
- >(createStringify, stringify);
613
- export { createStringifyPure as createStringify };
614
-
615
- /**
616
- * Creates a reusable {@link assertStringify} function.
617
- *
618
- * @danger You must configure the generic argument `T`
619
- * @returns Nothing until you configure the generic argument `T`
620
- * @throws compile error
621
- *
622
- * @author Jeongho Nam - https://github.com/samchon
623
- */
624
- function createAssertStringify(): never;
625
-
626
- /**
627
- * Creates a reusable {@link assertStringify} function.
628
- *
629
- * @template T Type of the input value
630
- * @returns A reusable `assertStringify` function
631
- *
632
- * @author Jeongho Nam - https://github.com/samchon
633
- */
634
- function createAssertStringify<T>(): (input: unknown) => string;
635
-
636
- /**
637
- * @internal
638
- */
639
- function createAssertStringify(): (input: unknown) => string {
640
- halt("createAssertStringify");
641
- }
642
-
643
- const createAssertStringifyPure = /** @__PURE__ */ Object.assign<
644
- typeof createAssertStringify,
645
- {}
646
- >(createAssertStringify, assertStringify);
647
- export { createAssertStringifyPure as createAssertStringify };
648
-
649
- /**
650
- * Creates a reusable {@link isStringify} function.
651
- *
652
- * @danger You must configure the generic argument `T`
653
- * @returns Nothing until you configure the generic argument `T`
654
- * @throws compile error
655
- *
656
- * @author Jeongho Nam - https://github.com/samchon
657
- */
658
- function createIsStringify(): never;
659
-
660
- /**
661
- * Creates a reusable {@link isStringify} function.
662
- *
663
- * @template T Type of the input value
664
- * @returns A reusable `isStringify` function
665
- *
666
- * @author Jeongho Nam - https://github.com/samchon
667
- */
668
- function createIsStringify<T>(): (input: unknown) => string | null;
669
-
670
- /**
671
- * @internal
672
- */
673
- function createIsStringify(): (input: unknown) => string | null {
674
- halt("createIsStringify");
675
- }
676
-
677
- const createIsStringifyPure = /** @__PURE__ */ Object.assign<
678
- typeof createIsStringify,
679
- {}
680
- >(createIsStringify, isStringify);
681
- export { createIsStringifyPure as createIsStringify };
682
-
683
- /**
684
- * Creates a reusable {@link validateStringify} function.
685
- *
686
- * @danger You must configure the generic argument `T`
687
- * @returns Nothing until you configure the generic argument `T`
688
- * @throws compile error
689
- *
690
- * @author Jeongho Nam - https://github.com/samchon
691
- */
692
- function createValidateStringify(): never;
693
-
694
- /**
695
- * Creates a reusable {@link validateStringify} function.
696
- *
697
- * @template T Type of the input value
698
- * @returns A reusable `validateStringify` function
699
-
700
- * @author Jeongho Nam - https://github.com/samchon
701
- */
702
- function createValidateStringify<T>(): (input: unknown) => IValidation<string>;
703
-
704
- /**
705
- * @internal
706
- */
707
- function createValidateStringify(): (input: unknown) => IValidation<string> {
708
- halt("createValidateStringify");
709
- }
710
-
711
- const createValidateStringifyPure = /** @__PURE__ */ Object.assign<
712
- typeof createValidateStringify,
713
- {}
714
- >(createValidateStringify, validateStringify);
715
- export { createValidateStringifyPure as createValidateStringify };
716
-
717
- /**
718
- * @internal
719
- */
720
- function halt(name: string): never {
721
- throw new Error(
722
- `Error on typia.json.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
723
- );
724
- }
1
+ import * as Namespace from "./functional/Namespace";
2
+
3
+ import { IJsonApplication } from "./schemas/json/IJsonApplication";
4
+
5
+ import { IValidation } from "./IValidation";
6
+ import { Primitive } from "./Primitive";
7
+
8
+ /* ===========================================================
9
+ JSON
10
+ - SCHEMA
11
+ - PARSE
12
+ - STRINGIFY
13
+ - FACTORY FUNCTIONS
14
+ ==============================================================
15
+ SCHEMA
16
+ ----------------------------------------------------------- */
17
+ /**
18
+ * > You must configure the generic argument `Types`.
19
+ *
20
+ * JSON Schema Application.
21
+ *
22
+ * Creates a JSON schema application which contains both main JSON schemas and
23
+ * components. Note that, all of the named types are stored in the
24
+ * {@link IJsonApplication.components} property for the `$ref` referencing.
25
+ *
26
+ * Also, `typia.json.application()` has two additional generic arguments.
27
+ *
28
+ * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
29
+ * For an example, `ajv` has an extra property "$recursiveRef" that are not
30
+ * exists in the standard JSON schema definition spec. Otherwise, `swagger`
31
+ * can't identify the tuple definition.
32
+ *
33
+ * The next *Surplus* means whether to allow surplus properties starting with
34
+ * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
35
+ * would be registered into the JSON schema, otherwise, not.
36
+ *
37
+ * @template Types Tuple of target types
38
+ * @template Purpose Purpose of the JSON schema
39
+ * @template Surplus Allow surplus properties starting with `x-typia-` or not
40
+ * @return JSON schema application
41
+ *
42
+ * @author Jeongho Nam - https://github.com/samchon
43
+ */
44
+ export function application(): never;
45
+
46
+ /**
47
+ * JSON Schema Application.
48
+ *
49
+ * Creates a JSON schema application which contains both main JSON schemas and
50
+ * components. Note that, all of the named types are stored in the
51
+ * {@link IJsonApplication.components} property for the `$ref` referencing.
52
+ *
53
+ * Also, `typia.json.application()` has two additional generic arguments.
54
+ *
55
+ * The 1st *Purpose* means the purpose determines the JSON schema definition spec.
56
+ * For an example, `ajv` has an extra property "$recursiveRef" that are not
57
+ * exists in the standard JSON schema definition spec. Otherwise, `swagger`
58
+ * can't identify the tuple definition.
59
+ *
60
+ * The next *Surplus* means whether to allow surplus properties starting with
61
+ * `x-typia-` or not. If `true`, the surplus properties like `x-typia-jsDocTags`
62
+ * would be registered into the JSON schema, otherwise, not.
63
+ *
64
+ * @template Types Tuple of target types
65
+ * @template Purpose Purpose of the JSON schema
66
+ * @template Surplus Allow surplus properties starting with `x-typia-` or not
67
+ * @return JSON schema application
68
+ *
69
+ * @author Jeongho Nam - https://github.com/samchon
70
+ */
71
+ export function application<
72
+ Types extends unknown[],
73
+ Purpose extends "ajv" | "swagger" = "swagger",
74
+ Surplus extends boolean = false,
75
+ >(): IJsonApplication;
76
+
77
+ /**
78
+ * @internal
79
+ */
80
+ export function application(): never {
81
+ halt("application");
82
+ }
83
+
84
+ /* -----------------------------------------------------------
85
+ PARSE
86
+ ----------------------------------------------------------- */
87
+ /**
88
+ * > You must configure the generic argument `T`.
89
+ *
90
+ * Safe `JSON.parse()` function with type assertion.
91
+ *
92
+ * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
93
+ * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
94
+ * to a `T` typed instance with type assertion.
95
+ *
96
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
97
+ * throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed value,
98
+ * the parsed value would be returned.
99
+ *
100
+ * @template T Expected type of parsed value
101
+ * @param input JSON string
102
+ * @returns Parsed value
103
+ *
104
+ * @author Jeongho Nam - https://github.com/samchon
105
+ */
106
+ function assertParse(input: string): never;
107
+
108
+ /**
109
+ * Safe `JSON.parse()` function with type assertion.
110
+ *
111
+ * `typia.json.assertParse()` is a combination function of `JSON.parse()` and
112
+ * {@link assert}. Therefore, it convers a JSON (JavaScript Object Notation) string
113
+ * to a `T` typed instance with type assertion.
114
+ *
115
+ * In such reason, when parsed JSON string value is not matched with the type `T`,
116
+ * it throws {@link TypeGuardError}. Otherwise, there's no problem on the parsed
117
+ * value, the parsed value would be returned.
118
+ *
119
+ * @template T Expected type of parsed value
120
+ * @param input JSON string
121
+ * @returns Parsed value
122
+ *
123
+ * @author Jeongho Nam - https://github.com/samchon
124
+ */
125
+ function assertParse<T>(input: string): Primitive<T>;
126
+
127
+ /**
128
+ * @internal
129
+ */
130
+ function assertParse<T>(): Primitive<T> {
131
+ halt("assertParse");
132
+ }
133
+ const assertParsePure = /** @__PURE__ */ Object.assign<typeof assertParse, {}>(
134
+ assertParse,
135
+ /** @__PURE__ */ Namespace.assert("json.assertParse"),
136
+ );
137
+ export { assertParsePure as assertParse };
138
+
139
+ /**
140
+ * > You must configure the generic argument `T`.
141
+ *
142
+ * Safe `JSON.parse()` function with type checking.
143
+ *
144
+ * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
145
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
146
+ * instance with type checking.
147
+ *
148
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
149
+ * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
150
+ * value would be returned.
151
+ *
152
+ * @template T Expected type of parsed value
153
+ * @param input JSON string
154
+ * @returns Parsed value when exact type, otherwise `null`
155
+ *
156
+ * @author Jeongho Nam - https://github.com/samchon
157
+ */
158
+ function isParse(input: string): never;
159
+
160
+ /**
161
+ * Safe `JSON.parse()` function with type checking.
162
+ *
163
+ * `typia.json.isParse()` is a combination function of `JSON.parse()` and {@link is}.
164
+ * Therefore, it convers a JSON (JavaScript Object Notation) string to a `T` typed
165
+ * instance with type checking.
166
+ *
167
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
168
+ * returns `null` value. Otherwise, there's no problem on the parsed value, the parsed
169
+ * value would be returned.
170
+ *
171
+ * @template T Expected type of parsed value
172
+ * @param input JSON string
173
+ * @returns Parsed value when exact type, otherwise `null`
174
+ *
175
+ * @author Jeongho Nam - https://github.com/samchon
176
+ */
177
+ function isParse<T>(input: string): Primitive<T> | null;
178
+
179
+ /**
180
+ * @internal
181
+ */
182
+ function isParse<T>(): Primitive<T> | null {
183
+ halt("isParse");
184
+ }
185
+ const isParsePure = /** @__PURE__ */ Object.assign<typeof isParse, {}>(
186
+ isParse,
187
+ /** @__PURE__ */ Namespace.is(),
188
+ );
189
+ export { isParsePure as isParse };
190
+
191
+ /**
192
+ * > You must configure the generic argument `T`.
193
+ *
194
+ * Safe `JSON.parse()` function with detailed type validation.
195
+ *
196
+ * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
197
+ * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
198
+ * to a `T` typed instance with detailed type validation.
199
+ *
200
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
201
+ * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
202
+ * there's no problem on the parsed value, the parsed value would be stored in `data`
203
+ * property of the output {@link IValidation.ISuccess} instance.
204
+ *
205
+ * @template T Expected type of parsed value
206
+ * @param input JSON string
207
+ * @returns Validation result with JSON parsed value
208
+ *
209
+ * @author Jeongho Nam - https://github.com/samchon
210
+ */
211
+ function validateParse(input: string): never;
212
+
213
+ /**
214
+ * Safe `JSON.parse()` function with detailed type validation.
215
+ *
216
+ * `typia.json.validateParse()` is a combination function of `JSON.parse()` and
217
+ * {@link validate}. Therefore, it convers a JSON (JavaScript Object Notation) string
218
+ * to a `T` typed instance with detailed type validation.
219
+ *
220
+ * In such reason, when parsed JSON string value is not matched with the type `T`, it
221
+ * returns {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
222
+ * there's no problem on the parsed value, the parsed value would be stored in `data`
223
+ * property of the output {@link IValidation.ISuccess} instance.
224
+ *
225
+ * @template T Expected type of parsed value
226
+ * @param input JSON string
227
+ * @returns Validation result with JSON parsed value
228
+ *
229
+ * @author Jeongho Nam - https://github.com/samchon
230
+ */
231
+ function validateParse<T>(input: string): IValidation<Primitive<T>>;
232
+
233
+ /**
234
+ * @internal
235
+ */
236
+ function validateParse<T>(): IValidation<Primitive<T>> {
237
+ halt("validateParse");
238
+ }
239
+ const validateParsePure = /** @__PURE__ */ Object.assign<
240
+ typeof validateParse,
241
+ {}
242
+ >(validateParse, /** @__PURE__ */ Namespace.validate());
243
+ export { validateParsePure as validateParse };
244
+
245
+ /* -----------------------------------------------------------
246
+ STRINGIFY
247
+ ----------------------------------------------------------- */
248
+ /**
249
+ * 8x faster `JSON.stringify()` function.
250
+ *
251
+ * Converts an input value to a JSON (JavaScript Object Notation) string, about 8x
252
+ * faster than the native `JSON.stringify()` function. The 5x faster principle is
253
+ * because it writes an optimized JSON conversion plan, only for the type `T`.
254
+ *
255
+ * For reference, this `typia.json.stringify()` does not validate the input value type.
256
+ * It just believes that the input value is following the type `T`. Therefore, if you
257
+ * can't ensure the input value type, it would be better to call one of below
258
+ * functions instead.
259
+ *
260
+ * - {@link assertStringify}
261
+ * - {@link isStringify}
262
+ * - {@link validateStringify}
263
+ *
264
+ * @template T Type of the input value
265
+ * @param input A value to be converted
266
+ * @return JSON string value
267
+ *
268
+ * @author Jeongho Nam - https://github.com/samchon
269
+ */
270
+ function stringify<T>(input: T): string;
271
+
272
+ /**
273
+ * @internal
274
+ */
275
+ function stringify(): never {
276
+ halt("stringify");
277
+ }
278
+ const stringifyPure = /** @__PURE__ */ Object.assign<typeof stringify, {}>(
279
+ stringify,
280
+ /** @__PURE__ */ Namespace.json.stringify("stringify"),
281
+ );
282
+ export { stringifyPure as stringify };
283
+
284
+ /**
285
+ * 5x faster `JSON.stringify()` function with type assertion.
286
+ *
287
+ * `typia.json.assertStringify()` is a combination function of {@link assert} and
288
+ * {@link stringify}. Therefore, it converts an input value to
289
+ * JSON (JavaScript Object Notation) string, with type assertion.
290
+ *
291
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
292
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
293
+ * string would be returned.
294
+ *
295
+ * For reference, with type assertion, it is even 5x times faster than the native
296
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
297
+ * with confidence.
298
+ *
299
+ * @template T Type of the input value
300
+ * @param input A value to be asserted and converted
301
+ * @return JSON string value
302
+ *
303
+ * @author Jeongho Nam - https://github.com/samchon
304
+ */
305
+ function assertStringify<T>(input: T): string;
306
+
307
+ /**
308
+ * 5x faster `JSON.stringify()` function with type assertion.
309
+ *
310
+ * `typia.json.assertStringify()` is a combination function of {@link assert} and
311
+ * {@link stringify}. Therefore, it converts an input value to
312
+ * JSON (JavaScript Object Notation) string, with type assertion.
313
+ *
314
+ * In such reason, when `input` value is not matched with the type `T`, it throws an
315
+ * {@link TypeGuardError}. Otherwise, there's no problem on the `input` value, JSON
316
+ * string would be returned.
317
+ *
318
+ * For reference, with type assertion, it is even 5x times faster than the native
319
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
320
+ * with confidence.
321
+ *
322
+ * @template T Type of the input value
323
+ * @param input A value to be asserted and converted
324
+ * @return JSON string value
325
+ *
326
+ * @author Jeongho Nam - https://github.com/samchon
327
+ */
328
+ function assertStringify<T>(input: T): unknown;
329
+
330
+ /**
331
+ * @internal
332
+ */
333
+ function assertStringify(): string {
334
+ halt("assertStringify");
335
+ }
336
+ const assertStringifyPure = /** @__PURE__ */ Object.assign<
337
+ typeof assertStringify,
338
+ {},
339
+ {}
340
+ >(
341
+ assertStringify,
342
+ /** @__PURE__ */ Namespace.assert("json.assertStringify"),
343
+ /** @__PURE__ */ Namespace.json.stringify("assertStringify"),
344
+ );
345
+ export { assertStringifyPure as assertStringify };
346
+
347
+ /**
348
+ * 7x faster `JSON.stringify()` function with type checking.
349
+ *
350
+ * `typia.json.stringify()` is a combination function of {@link is} and
351
+ * {@link stringify}. Therefore, it converts an input value to JSON
352
+ * (JavaScript Object Notation) string, with type checking.
353
+ *
354
+ * In such reason, when `input` value is not matched with the type `T`, it returns
355
+ * `null` value. Otherwise, there's no problem on the `input` value, JSON string
356
+ * would be returned.
357
+ *
358
+ * For reference, with type checking, it is even 7x times faster than the native
359
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
360
+ * with confidence.
361
+ *
362
+ * @template T Type of the input value
363
+ * @param input A value to be checked and converted
364
+ * @return JSON string value when exact type, otherwise null
365
+ *
366
+ * @author Jeongho Nam - https://github.com/samchon
367
+ */
368
+ function isStringify<T>(input: T): string | null;
369
+
370
+ /**
371
+ * 7x faster `JSON.stringify()` function with type checking.
372
+ *
373
+ * `typia.json.isStringify()` is a combination function of {@link is} and
374
+ * {@link stringify}. Therefore, it converts an input value to JSON
375
+ * (JavaScript Object Notation) string, with type checking.
376
+ *
377
+ * In such reason, when `input` value is not matched with the type `T`, it returns
378
+ * `null` value. Otherwise, there's no problem on the `input` value, JSON string
379
+ * would be returned.
380
+ *
381
+ * For reference, with type checking, it is even 7x times faster than the native
382
+ * `JSON.stringify()` function. So, just enjoy the safe and fast JSON conversion
383
+ * with confidence.
384
+ *
385
+ * @template T Type of the input value
386
+ * @param input A value to be checked and converted
387
+ * @return JSON string value when exact type, otherwise null
388
+ *
389
+ * @author Jeongho Nam - https://github.com/samchon
390
+ */
391
+ function isStringify<T>(input: unknown): string | null;
392
+
393
+ /**
394
+ * @internal
395
+ */
396
+ function isStringify(): string | null {
397
+ halt("isStringify");
398
+ }
399
+
400
+ const isStringifyPure = /** @__PURE__ */ Object.assign<
401
+ typeof isStringify,
402
+ {},
403
+ {}
404
+ >(
405
+ isStringify,
406
+ /** @__PURE__ */ Namespace.is(),
407
+ /** @__PURE__ */ Namespace.json.stringify("isStringify"),
408
+ );
409
+ export { isStringifyPure as isStringify };
410
+
411
+ /**
412
+ * 5x faster `JSON.stringify()` function with detailed type validation.
413
+ *
414
+ * `typia.json.validateStringify()` is a combination function of {@link validate} and
415
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
416
+ * Notation) string, with detailed type validation.
417
+ *
418
+ * In such reason, when `input` value is not matched with the type `T`, it returns
419
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
420
+ * there's no problem on the `input` value, JSON string would be stored in `data`
421
+ * property of the output {@link IValidation.ISuccess} instance.
422
+ *
423
+ * For reference, with detailed type validation, it is even 5x times faster than the
424
+ * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
425
+ * conversion with confidence.
426
+ *
427
+ * @template T Type of the input value
428
+ * @param input A value to be checked and converted
429
+ * @returns Validation result with JSON string value
430
+ *
431
+ * @author Jeongho Nam - https://github.com/samchon
432
+ */
433
+ function validateStringify<T>(input: T): IValidation<string>;
434
+
435
+ /**
436
+ * 5x faster `JSON.stringify()` function with detailed type validation.
437
+ *
438
+ * `typia.json.validateStringify()` is a combination function of {@link validate} and
439
+ * {@link stringify}. Therefore, it converts an input value to JSON (JavaScript Object
440
+ * Notation) string, with detailed type validation.
441
+ *
442
+ * In such reason, when `input` value is not matched with the type `T`, it returns
443
+ * {@link IValidation.IFailure} value with detailed error reasons. Otherwise,
444
+ * there's no problem on the `input` value, JSON string would be stored in `data`
445
+ * property of the output {@link IValidation.ISuccess} instance.
446
+ *
447
+ * For reference, with detailed type validation, it is even 5x times faster than the
448
+ * native `JSON.stringify()` function. So, just enjoy the safe and fast JSON
449
+ * conversion with confidence.
450
+ *
451
+ * @template T Type of the input value
452
+ * @param input A value to be checked and converted
453
+ * @returns Validation result with JSON string value
454
+ *
455
+ * @author Jeongho Nam - https://github.com/samchon
456
+ */
457
+ function validateStringify<T>(input: unknown): IValidation<string>;
458
+
459
+ /**
460
+ * @internal
461
+ */
462
+ function validateStringify(): IValidation<string> {
463
+ halt("validateStringify");
464
+ }
465
+ const validateStringifyPure = /** @__PURE__ */ Object.assign<
466
+ typeof validateStringify,
467
+ {},
468
+ {}
469
+ >(
470
+ validateStringify,
471
+ /** @__PURE__ */ Namespace.validate(),
472
+ /** @__PURE__ */ Namespace.json.stringify("validateStringify"),
473
+ );
474
+ export { validateStringifyPure as validateStringify };
475
+
476
+ /* -----------------------------------------------------------
477
+ FACTORY FUNCTIONS
478
+ ----------------------------------------------------------- */
479
+ /**
480
+ * Creates a reusable {@link isParse} function.
481
+ *
482
+ * @danger You must configure the generic argument `T`
483
+ * @returns Nothing until you configure the generic argument `T`
484
+ * @throws compile error
485
+ *
486
+ * @author Jeongho Nam - https://github.com/samchon
487
+ */
488
+ function createIsParse(): never;
489
+
490
+ /**
491
+ * Creates a reusable {@link isParse} function.
492
+ *
493
+ * @template T Expected type of parsed value
494
+ * @returns A reusable `isParse` function
495
+ *
496
+ * @author Jeongho Nam - https://github.com/samchon
497
+ */
498
+ function createIsParse<T>(): (input: string) => Primitive<T> | null;
499
+
500
+ /**
501
+ * @internal
502
+ */
503
+ function createIsParse<T>(): (input: string) => Primitive<T> | null {
504
+ halt("createIsParse");
505
+ }
506
+ const createIsParsePure = /** @__PURE__ */ Object.assign<
507
+ typeof createIsParse,
508
+ {}
509
+ >(createIsParse, isParsePure);
510
+ export { createIsParsePure as createIsParse };
511
+
512
+ /**
513
+ * Creates a reusable {@link assertParse} function.
514
+ *
515
+ * @danger You must configure the generic argument `T`
516
+ * @returns Nothing until you configure the generic argument `T`
517
+ * @throws compile error
518
+ *
519
+ * @author Jeongho Nam - https://github.com/samchon
520
+ */
521
+ function createAssertParse(): never;
522
+
523
+ /**
524
+ * Creates a reusable {@link assertParse} function.
525
+ *
526
+ * @template T Expected type of parsed value
527
+ * @returns A reusable `assertParse` function
528
+ *
529
+ * @author Jeongho Nam - https://github.com/samchon
530
+ */
531
+ function createAssertParse<T>(): (input: string) => Primitive<T>;
532
+
533
+ /**
534
+ * @internal
535
+ */
536
+ function createAssertParse<T>(): (input: string) => Primitive<T> {
537
+ halt("createAssertParse");
538
+ }
539
+ const createAssertParsePure = /** @__PURE__ */ Object.assign<
540
+ typeof createAssertParse,
541
+ {}
542
+ >(createAssertParse, assertParsePure);
543
+ export { createAssertParsePure as createAssertParse };
544
+
545
+ /**
546
+ * Creates a reusable {@link validateParse} function.
547
+ *
548
+ * @danger You must configure the generic argument `T`
549
+ * @returns Nothing until you configure the generic argument `T`
550
+ * @throws compile error
551
+ *
552
+ * @author Jeongho Nam - https://github.com/samchon
553
+ */
554
+ function createValidateParse(): never;
555
+
556
+ /**
557
+ * Creates a reusable {@link validateParse} function.
558
+ *
559
+ * @template T Expected type of parsed value
560
+ * @returns A reusable `validateParse` function
561
+ *
562
+ * @author Jeongho Nam - https://github.com/samchon
563
+ */
564
+ function createValidateParse<T>(): (input: string) => IValidation<Primitive<T>>;
565
+
566
+ /**
567
+ * @internal
568
+ */
569
+ function createValidateParse<T>(): (
570
+ input: string,
571
+ ) => IValidation<Primitive<T>> {
572
+ halt("createValidateParse");
573
+ }
574
+
575
+ const createValidateParsePure = /** @__PURE__ */ Object.assign<
576
+ typeof createValidateParse,
577
+ {}
578
+ >(createValidateParse, validateParsePure);
579
+ export { createValidateParsePure as createValidateParse };
580
+
581
+ /**
582
+ * Creates a reusable {@link stringify} function.
583
+ *
584
+ * @danger You must configure the generic argument `T`
585
+ * @returns Nothing until you configure the generic argument `T`
586
+ * @throws compile error
587
+ *
588
+ * @author Jeongho Nam - https://github.com/samchon
589
+ */
590
+ function createStringify(): never;
591
+
592
+ /**
593
+ * Creates a reusable {@link stringify} function.
594
+ *
595
+ * @template T Type of the input value
596
+ * @returns A reusable `stringify` function
597
+ *
598
+ * @author Jeongho Nam - https://github.com/samchon
599
+ */
600
+ function createStringify<T>(): (input: T) => string;
601
+
602
+ /**
603
+ * @internal
604
+ */
605
+ function createStringify<T>(): (input: T) => string {
606
+ halt("createStringify");
607
+ }
608
+
609
+ const createStringifyPure = /** @__PURE__ */ Object.assign<
610
+ typeof createStringify,
611
+ {}
612
+ >(createStringify, stringifyPure);
613
+ export { createStringifyPure as createStringify };
614
+
615
+ /**
616
+ * Creates a reusable {@link assertStringify} function.
617
+ *
618
+ * @danger You must configure the generic argument `T`
619
+ * @returns Nothing until you configure the generic argument `T`
620
+ * @throws compile error
621
+ *
622
+ * @author Jeongho Nam - https://github.com/samchon
623
+ */
624
+ function createAssertStringify(): never;
625
+
626
+ /**
627
+ * Creates a reusable {@link assertStringify} function.
628
+ *
629
+ * @template T Type of the input value
630
+ * @returns A reusable `assertStringify` function
631
+ *
632
+ * @author Jeongho Nam - https://github.com/samchon
633
+ */
634
+ function createAssertStringify<T>(): (input: unknown) => string;
635
+
636
+ /**
637
+ * @internal
638
+ */
639
+ function createAssertStringify(): (input: unknown) => string {
640
+ halt("createAssertStringify");
641
+ }
642
+
643
+ const createAssertStringifyPure = /** @__PURE__ */ Object.assign<
644
+ typeof createAssertStringify,
645
+ {}
646
+ >(createAssertStringify, assertStringifyPure);
647
+ export { createAssertStringifyPure as createAssertStringify };
648
+
649
+ /**
650
+ * Creates a reusable {@link isStringify} function.
651
+ *
652
+ * @danger You must configure the generic argument `T`
653
+ * @returns Nothing until you configure the generic argument `T`
654
+ * @throws compile error
655
+ *
656
+ * @author Jeongho Nam - https://github.com/samchon
657
+ */
658
+ function createIsStringify(): never;
659
+
660
+ /**
661
+ * Creates a reusable {@link isStringify} function.
662
+ *
663
+ * @template T Type of the input value
664
+ * @returns A reusable `isStringify` function
665
+ *
666
+ * @author Jeongho Nam - https://github.com/samchon
667
+ */
668
+ function createIsStringify<T>(): (input: unknown) => string | null;
669
+
670
+ /**
671
+ * @internal
672
+ */
673
+ function createIsStringify(): (input: unknown) => string | null {
674
+ halt("createIsStringify");
675
+ }
676
+
677
+ const createIsStringifyPure = /** @__PURE__ */ Object.assign<
678
+ typeof createIsStringify,
679
+ {}
680
+ >(createIsStringify, isStringifyPure);
681
+ export { createIsStringifyPure as createIsStringify };
682
+
683
+ /**
684
+ * Creates a reusable {@link validateStringify} function.
685
+ *
686
+ * @danger You must configure the generic argument `T`
687
+ * @returns Nothing until you configure the generic argument `T`
688
+ * @throws compile error
689
+ *
690
+ * @author Jeongho Nam - https://github.com/samchon
691
+ */
692
+ function createValidateStringify(): never;
693
+
694
+ /**
695
+ * Creates a reusable {@link validateStringify} function.
696
+ *
697
+ * @template T Type of the input value
698
+ * @returns A reusable `validateStringify` function
699
+
700
+ * @author Jeongho Nam - https://github.com/samchon
701
+ */
702
+ function createValidateStringify<T>(): (input: unknown) => IValidation<string>;
703
+
704
+ /**
705
+ * @internal
706
+ */
707
+ function createValidateStringify(): (input: unknown) => IValidation<string> {
708
+ halt("createValidateStringify");
709
+ }
710
+
711
+ const createValidateStringifyPure = /** @__PURE__ */ Object.assign<
712
+ typeof createValidateStringify,
713
+ {}
714
+ >(createValidateStringify, validateStringifyPure);
715
+ export { createValidateStringifyPure as createValidateStringify };
716
+
717
+ /**
718
+ * @internal
719
+ */
720
+ function halt(name: string): never {
721
+ throw new Error(
722
+ `Error on typia.json.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
723
+ );
724
+ }