typia 5.3.0-dev.20231112 → 5.3.0-dev.20231117
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/lib/AssertionGuard.d.ts +1 -0
- package/lib/AssertionGuard.js +3 -0
- package/lib/AssertionGuard.js.map +1 -0
- package/lib/module.d.ts +208 -0
- package/lib/module.js +22 -1
- package/lib/module.js.map +1 -1
- package/lib/programmers/AssertProgrammer.d.ts +4 -1
- package/lib/programmers/AssertProgrammer.js +16 -9
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.js +30 -6
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/AssertTransformer.d.ts +4 -1
- package/lib/transformers/features/AssertTransformer.js +9 -3
- package/lib/transformers/features/AssertTransformer.js.map +1 -1
- package/lib/transformers/features/CreateAssertTransformer.d.ts +4 -1
- package/lib/transformers/features/CreateAssertTransformer.js +9 -3
- package/lib/transformers/features/CreateAssertTransformer.js.map +1 -1
- package/package.json +1 -1
- package/src/AssertionGuard.ts +1 -0
- package/src/module.ts +252 -0
- package/src/programmers/AssertProgrammer.ts +31 -11
- package/src/transformers/CallExpressionTransformer.ts +20 -6
- package/src/transformers/features/AssertTransformer.ts +11 -3
- package/src/transformers/features/CreateAssertTransformer.ts +9 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AssertionGuard<T> = (input: unknown) => asserts input is T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssertionGuard.js","sourceRoot":"","sources":["../src/AssertionGuard.ts"],"names":[],"mappings":""}
|
package/lib/module.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AssertionGuard } from "./AssertionGuard";
|
|
1
2
|
import { IRandomGenerator } from "./IRandomGenerator";
|
|
2
3
|
import { IValidation } from "./IValidation";
|
|
3
4
|
import { Resolved } from "./Resolved";
|
|
@@ -11,6 +12,7 @@ export * as tags from "./tags";
|
|
|
11
12
|
export * from "./schemas/json/IJsonApplication";
|
|
12
13
|
export * from "./schemas/json/IJsonComponents";
|
|
13
14
|
export * from "./schemas/json/IJsonSchema";
|
|
15
|
+
export * from "./AssertionGuard";
|
|
14
16
|
export * from "./IRandomGenerator";
|
|
15
17
|
export * from "./IValidation";
|
|
16
18
|
export * from "./TypeGuardError";
|
|
@@ -29,6 +31,8 @@ export * from "./SnakeCase";
|
|
|
29
31
|
* If what you want is not asserting but just knowing whether the parametric value is
|
|
30
32
|
* following the type `T` or not, you can choose the {@link is} function instead.
|
|
31
33
|
* Otherwise you want to know all the errors, {@link validate} is the way to go.
|
|
34
|
+
* Also, if you want to automatically cast the parametric value to the type `T`
|
|
35
|
+
* when no problem (perform the assertion guard of type).
|
|
32
36
|
*
|
|
33
37
|
* On the other and, if you don't want to allow any superfluous property that is not
|
|
34
38
|
* enrolled to the type `T`, you can use {@link assertEquals} function instead.
|
|
@@ -63,6 +67,56 @@ export declare function assert<T>(input: T): T;
|
|
|
63
67
|
* @author Jeongho Nam - https://github.com/samchon
|
|
64
68
|
*/
|
|
65
69
|
export declare function assert<T>(input: unknown): T;
|
|
70
|
+
/**
|
|
71
|
+
* Assertion guard of a value type.
|
|
72
|
+
*
|
|
73
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
74
|
+
* reason, if the parametric value is not following the type `T`. Otherwise, the
|
|
75
|
+
* value is following the type `T`, nothing would be returned, but the input value
|
|
76
|
+
* would be automatically casted to the type `T`. This is the concept of
|
|
77
|
+
* "assertion guard" of a value type.
|
|
78
|
+
*
|
|
79
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
80
|
+
* following the type `T` or not, you can choose the {@link is} function instead.
|
|
81
|
+
* Otherwise you want to know all the errors, {@link validate} is the way to go.
|
|
82
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
83
|
+
* {@link assert} function instead.
|
|
84
|
+
*
|
|
85
|
+
* On the other and, if you don't want to allow any superfluous property that is not
|
|
86
|
+
* enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
|
|
87
|
+
*
|
|
88
|
+
* @template T Type of the input value
|
|
89
|
+
* @param input A value to be asserted
|
|
90
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
91
|
+
*
|
|
92
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
93
|
+
*/
|
|
94
|
+
export declare function assertGuard<T>(input: T): asserts input is T;
|
|
95
|
+
/**
|
|
96
|
+
* Assertion guard of a value type.
|
|
97
|
+
*
|
|
98
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
99
|
+
* reason, if the parametric value is not following the type `T`. Otherwise, the
|
|
100
|
+
* value is following the type `T`, nothing would be returned, but the input value
|
|
101
|
+
* would be automatically casted to the type `T`. This is the concept of
|
|
102
|
+
* "assertion guard" of a value type.
|
|
103
|
+
*
|
|
104
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
105
|
+
* following the type `T` or not, you can choose the {@link is} function instead.
|
|
106
|
+
* Otherwise you want to know all the errors, {@link validate} is the way to go.
|
|
107
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
108
|
+
* {@link assert} function instead.
|
|
109
|
+
*
|
|
110
|
+
* On the other and, if you don't want to allow any superfluous property that is not
|
|
111
|
+
* enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
|
|
112
|
+
*
|
|
113
|
+
* @template T Type of the input value
|
|
114
|
+
* @param input A value to be asserted
|
|
115
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
116
|
+
*
|
|
117
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
118
|
+
*/
|
|
119
|
+
export declare function assertGuard<T>(input: unknown): asserts input is T;
|
|
66
120
|
/**
|
|
67
121
|
* Tests a value type.
|
|
68
122
|
*
|
|
@@ -205,6 +259,62 @@ export declare function assertEquals<T>(input: T): T;
|
|
|
205
259
|
* @author Jeongho Nam - https://github.com/samchon
|
|
206
260
|
*/
|
|
207
261
|
export declare function assertEquals<T>(input: unknown): T;
|
|
262
|
+
/**
|
|
263
|
+
* Assertion guard of a type with equality.
|
|
264
|
+
*
|
|
265
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
266
|
+
* reason, if the parametric value is not following the type `T` or some superfluous
|
|
267
|
+
* property that is not listed on the type `T` has been found.
|
|
268
|
+
*
|
|
269
|
+
* Otherwise, the value is following the type `T` without any superfluous property,
|
|
270
|
+
* nothing would be returned, but the input value would be automatically casted to
|
|
271
|
+
* the type `T`. This is the concept of "assertion guard" of a value type.
|
|
272
|
+
*
|
|
273
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
274
|
+
* following the type `T` or not, you can choose the {@link equals} function instead.
|
|
275
|
+
* Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
|
|
276
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
277
|
+
* {@link assert} function instead.
|
|
278
|
+
*
|
|
279
|
+
* On the other hand, if you want to allow superfluous property that is not enrolled
|
|
280
|
+
* to the type `T`, you can use {@link assertEquals} function instead.
|
|
281
|
+
*
|
|
282
|
+
* @template T Type of the input value
|
|
283
|
+
* @param input A value to be asserted
|
|
284
|
+
* @returns Parametric input value casted as `T`
|
|
285
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
286
|
+
*
|
|
287
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
288
|
+
*/
|
|
289
|
+
export declare function assertGuardEquals<T>(input: T): asserts input is T;
|
|
290
|
+
/**
|
|
291
|
+
* Assertion guard of a type with equality.
|
|
292
|
+
*
|
|
293
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
294
|
+
* reason, if the parametric value is not following the type `T` or some superfluous
|
|
295
|
+
* property that is not listed on the type `T` has been found.
|
|
296
|
+
*
|
|
297
|
+
* Otherwise, the value is following the type `T` without any superfluous property,
|
|
298
|
+
* nothing would be returned, but the input value would be automatically casted to
|
|
299
|
+
* the type `T`. This is the concept of "assertion guard" of a value type.
|
|
300
|
+
*
|
|
301
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
302
|
+
* following the type `T` or not, you can choose the {@link equals} function instead.
|
|
303
|
+
* Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
|
|
304
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
305
|
+
* {@link assertEquals} function instead.
|
|
306
|
+
*
|
|
307
|
+
* On the other hand, if you want to allow superfluous property that is not enrolled
|
|
308
|
+
* to the type `T`, you can use {@link assertGuard} function instead.
|
|
309
|
+
*
|
|
310
|
+
* @template T Type of the input value
|
|
311
|
+
* @param input A value to be asserted
|
|
312
|
+
* @returns Parametric input value casted as `T`
|
|
313
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
314
|
+
*
|
|
315
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
316
|
+
*/
|
|
317
|
+
export declare function assertGuardEquals<T>(input: unknown): asserts input is T;
|
|
208
318
|
/**
|
|
209
319
|
* Tests equality between a value and its type.
|
|
210
320
|
*
|
|
@@ -358,6 +468,55 @@ export declare function createAssert(): never;
|
|
|
358
468
|
* @author Jeongho Nam - https://github.com/samchon
|
|
359
469
|
*/
|
|
360
470
|
export declare function createAssert<T>(): (input: unknown) => T;
|
|
471
|
+
/**
|
|
472
|
+
* Creates a reusable {@link assertGuard} function.
|
|
473
|
+
*
|
|
474
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
475
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
476
|
+
* This is the special rule of the TypeScript compiler.
|
|
477
|
+
*
|
|
478
|
+
* ```typescript
|
|
479
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
480
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
|
|
481
|
+
*
|
|
482
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
483
|
+
* const func = typia.createAssertGuard<number>();
|
|
484
|
+
* ```
|
|
485
|
+
*
|
|
486
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
487
|
+
* > *explicit type annotation.*
|
|
488
|
+
*
|
|
489
|
+
* @danger You must configure the generic argument `T`
|
|
490
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
491
|
+
* @throws compile error
|
|
492
|
+
*
|
|
493
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
494
|
+
*/
|
|
495
|
+
export declare function createAssertGuard(): never;
|
|
496
|
+
/**
|
|
497
|
+
* Creates a reusable {@link assertGuard} function.
|
|
498
|
+
*
|
|
499
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
500
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
501
|
+
* This is the special rule of the TypeScript compiler.
|
|
502
|
+
*
|
|
503
|
+
* ```typescript
|
|
504
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
505
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
|
|
506
|
+
*
|
|
507
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
508
|
+
* const func = typia.createAssertGuard<number>();
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
512
|
+
* > *explicit type annotation.*
|
|
513
|
+
*
|
|
514
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
515
|
+
* @throws compile error
|
|
516
|
+
*
|
|
517
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
518
|
+
*/
|
|
519
|
+
export declare function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T>;
|
|
361
520
|
/**
|
|
362
521
|
* Creates a reusable {@link is} function.
|
|
363
522
|
*
|
|
@@ -415,6 +574,55 @@ export declare function createAssertEquals(): never;
|
|
|
415
574
|
* @author Jeongho Nam - https://github.com/samchon
|
|
416
575
|
*/
|
|
417
576
|
export declare function createAssertEquals<T>(): (input: unknown) => T;
|
|
577
|
+
/**
|
|
578
|
+
* Creates a reusable {@link assertGuardEquals} function.
|
|
579
|
+
*
|
|
580
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
581
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
582
|
+
* This is the special rule of the TypeScript compiler.
|
|
583
|
+
*
|
|
584
|
+
* ```typescript
|
|
585
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
586
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
|
|
587
|
+
*
|
|
588
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
589
|
+
* const func = typia.createAssertGuardEquals<number>();
|
|
590
|
+
* ```
|
|
591
|
+
*
|
|
592
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
593
|
+
* > *explicit type annotation.*
|
|
594
|
+
*
|
|
595
|
+
* @danger You must configure the generic argument `T`
|
|
596
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
597
|
+
* @throws compile error
|
|
598
|
+
*
|
|
599
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
600
|
+
*/
|
|
601
|
+
export declare function createAssertGuardEquals(): never;
|
|
602
|
+
/**
|
|
603
|
+
* Creates a reusable {@link assertGuardEquals} function.
|
|
604
|
+
*
|
|
605
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
606
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
607
|
+
* This is the special rule of the TypeScript compiler.
|
|
608
|
+
*
|
|
609
|
+
* ```typescript
|
|
610
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
611
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
|
|
612
|
+
*
|
|
613
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
614
|
+
* const func = typia.createAssertGuardEquals<number>();
|
|
615
|
+
* ```
|
|
616
|
+
*
|
|
617
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
618
|
+
* > *explicit type annotation.*
|
|
619
|
+
*
|
|
620
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
621
|
+
* @throws compile error
|
|
622
|
+
*
|
|
623
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
624
|
+
*/
|
|
625
|
+
export declare function createAssertGuardEquals<T>(): (input: unknown) => AssertionGuard<T>;
|
|
418
626
|
/**
|
|
419
627
|
* Creates a reusable {@link equals} function.
|
|
420
628
|
*
|
package/lib/module.js
CHANGED
|
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.createRandom = exports.createValidateEquals = exports.createEquals = exports.createAssertEquals = exports.createValidate = exports.createIs = exports.createAssert = exports.random = exports.validateEquals = exports.equals = exports.assertEquals = exports.validate = exports.is = exports.assert = exports.tags = exports.reflect = exports.protobuf = exports.notations = exports.misc = exports.json = exports.http = void 0;
|
|
29
|
+
exports.createRandom = exports.createValidateEquals = exports.createEquals = exports.createAssertGuardEquals = exports.createAssertEquals = exports.createValidate = exports.createIs = exports.createAssertGuard = exports.createAssert = exports.random = exports.validateEquals = exports.equals = exports.assertGuardEquals = exports.assertEquals = exports.validate = exports.is = exports.assertGuard = exports.assert = exports.tags = exports.reflect = exports.protobuf = exports.notations = exports.misc = exports.json = exports.http = void 0;
|
|
30
30
|
var Namespace_1 = require("./functional/Namespace");
|
|
31
31
|
exports.http = __importStar(require("./http"));
|
|
32
32
|
exports.json = __importStar(require("./json"));
|
|
@@ -38,6 +38,7 @@ exports.tags = __importStar(require("./tags"));
|
|
|
38
38
|
__exportStar(require("./schemas/json/IJsonApplication"), exports);
|
|
39
39
|
__exportStar(require("./schemas/json/IJsonComponents"), exports);
|
|
40
40
|
__exportStar(require("./schemas/json/IJsonSchema"), exports);
|
|
41
|
+
__exportStar(require("./AssertionGuard"), exports);
|
|
41
42
|
__exportStar(require("./IRandomGenerator"), exports);
|
|
42
43
|
__exportStar(require("./IValidation"), exports);
|
|
43
44
|
__exportStar(require("./TypeGuardError"), exports);
|
|
@@ -51,6 +52,11 @@ function assert() {
|
|
|
51
52
|
}
|
|
52
53
|
exports.assert = assert;
|
|
53
54
|
Object.assign(assert, Namespace_1.Namespace.assert("assert"));
|
|
55
|
+
function assertGuard() {
|
|
56
|
+
halt("assertGuard");
|
|
57
|
+
}
|
|
58
|
+
exports.assertGuard = assertGuard;
|
|
59
|
+
Object.assign(assertGuard, Namespace_1.Namespace.assert("assertGuard"));
|
|
54
60
|
function is() {
|
|
55
61
|
halt("is");
|
|
56
62
|
}
|
|
@@ -66,6 +72,11 @@ function assertEquals() {
|
|
|
66
72
|
}
|
|
67
73
|
exports.assertEquals = assertEquals;
|
|
68
74
|
Object.assign(assertEquals, Namespace_1.Namespace.assert("assertEquals"));
|
|
75
|
+
function assertGuardEquals() {
|
|
76
|
+
halt("assertGuardEquals");
|
|
77
|
+
}
|
|
78
|
+
exports.assertGuardEquals = assertGuardEquals;
|
|
79
|
+
Object.assign(assertGuardEquals, Namespace_1.Namespace.assert("assertGuardEquals"));
|
|
69
80
|
function equals() {
|
|
70
81
|
halt("equals");
|
|
71
82
|
}
|
|
@@ -86,6 +97,11 @@ function createAssert() {
|
|
|
86
97
|
}
|
|
87
98
|
exports.createAssert = createAssert;
|
|
88
99
|
Object.assign(createAssert, assert);
|
|
100
|
+
function createAssertGuard() {
|
|
101
|
+
halt("createAssertGuard");
|
|
102
|
+
}
|
|
103
|
+
exports.createAssertGuard = createAssertGuard;
|
|
104
|
+
Object.assign(createAssertGuard, assertGuard);
|
|
89
105
|
function createIs() {
|
|
90
106
|
halt("createIs");
|
|
91
107
|
}
|
|
@@ -101,6 +117,11 @@ function createAssertEquals() {
|
|
|
101
117
|
}
|
|
102
118
|
exports.createAssertEquals = createAssertEquals;
|
|
103
119
|
Object.assign(createAssertEquals, assertEquals);
|
|
120
|
+
function createAssertGuardEquals() {
|
|
121
|
+
halt("createAssertGuardEquals");
|
|
122
|
+
}
|
|
123
|
+
exports.createAssertGuardEquals = createAssertGuardEquals;
|
|
124
|
+
Object.assign(createAssertGuardEquals, assertGuardEquals);
|
|
104
125
|
function createEquals() {
|
|
105
126
|
halt("createEquals");
|
|
106
127
|
}
|
package/lib/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAmD;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAmD;AAOnD,+CAA+B;AAC/B,+CAA+B;AAC/B,+CAA+B;AAC/B,yDAAyC;AACzC,uDAAuC;AACvC,qDAAqC;AACrC,+CAA+B;AAE/B,kEAAgD;AAChD,iEAA+C;AAC/C,6DAA2C;AAC3C,mDAAiC;AACjC,qDAAmC;AACnC,gDAA8B;AAC9B,mDAAiC;AAEjC,8CAA4B;AAC5B,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAwD5B,SAAgB,MAAM;IAClB,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnB,CAAC;AAFD,wBAEC;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAyDlD,SAAgB,WAAW;IACvB,IAAI,CAAC,aAAa,CAAC,CAAC;AACxB,CAAC;AAFD,kCAEC;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,qBAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAqD5D,SAAgB,EAAE;IACd,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAFD,gBAEC;AACD,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,qBAAS,CAAC,MAA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C;AACN,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { IProject } from "../transformers/IProject";
|
|
3
3
|
export declare namespace AssertProgrammer {
|
|
4
|
-
const write: (project: IProject) => (modulo: ts.LeftHandSideExpression) => (
|
|
4
|
+
const write: (project: IProject) => (modulo: ts.LeftHandSideExpression) => (props: boolean | {
|
|
5
|
+
equals: boolean;
|
|
6
|
+
guard: boolean;
|
|
7
|
+
}) => (type: ts.Type, name?: string) => ts.ArrowFunction;
|
|
5
8
|
}
|
|
@@ -42,16 +42,18 @@ var AssertProgrammer;
|
|
|
42
42
|
(function (AssertProgrammer) {
|
|
43
43
|
AssertProgrammer.write = function (project) {
|
|
44
44
|
return function (modulo) {
|
|
45
|
-
return function (
|
|
45
|
+
return function (props) {
|
|
46
46
|
return function (type, name) {
|
|
47
|
+
if (typeof props === "boolean")
|
|
48
|
+
props = { equals: props, guard: false };
|
|
47
49
|
var importer = new FunctionImporeter_1.FunctionImporter(modulo.getText());
|
|
48
|
-
var is = IsProgrammer_1.IsProgrammer.write(project)(modulo, true)(equals)(type, name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(project.checker)(type));
|
|
50
|
+
var is = IsProgrammer_1.IsProgrammer.write(project)(modulo, true)(props.equals)(type, name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(project.checker)(type));
|
|
49
51
|
var assert = CheckerProgrammer_1.CheckerProgrammer.write(project)({
|
|
50
52
|
prefix: "$a",
|
|
51
53
|
path: true,
|
|
52
54
|
trace: true,
|
|
53
55
|
numeric: OptionPredicator_1.OptionPredicator.numeric(project.options),
|
|
54
|
-
equals: equals,
|
|
56
|
+
equals: props.equals,
|
|
55
57
|
atomist: function (explore) { return function (entry) { return function (input) {
|
|
56
58
|
return __spreadArray(__spreadArray([], __read((entry.expression ? [entry.expression] : [])), false), __read((entry.conditions.length === 0
|
|
57
59
|
? []
|
|
@@ -81,22 +83,27 @@ var AssertProgrammer;
|
|
|
81
83
|
: "_path"), entry.expected, input)),
|
|
82
84
|
])), false).reduce(function (x, y) { return typescript_1.default.factory.createLogicalAnd(x, y); });
|
|
83
85
|
}; }; },
|
|
84
|
-
combiner: combiner(equals)(project)(importer),
|
|
85
|
-
joiner: joiner(equals)(project)(importer),
|
|
86
|
+
combiner: combiner(props.equals)(project)(importer),
|
|
87
|
+
joiner: joiner(props.equals)(project)(importer),
|
|
86
88
|
success: typescript_1.default.factory.createTrue(),
|
|
87
89
|
addition: function () { return importer.declare(modulo); },
|
|
88
90
|
})(importer)(type, name);
|
|
89
91
|
return typescript_1.default.factory.createArrowFunction(undefined, undefined, [
|
|
90
92
|
IdentifierFactory_1.IdentifierFactory.parameter("input", TypeFactory_1.TypeFactory.keyword("any")),
|
|
91
|
-
],
|
|
93
|
+
], props.guard
|
|
94
|
+
? typescript_1.default.factory.createTypePredicateNode(typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.AssertsKeyword), typescript_1.default.factory.createIdentifier("input"), typescript_1.default.factory.createTypeReferenceNode(name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(project.checker)(type)))
|
|
95
|
+
: typescript_1.default.factory.createTypeReferenceNode(name !== null && name !== void 0 ? name : TypeFactory_1.TypeFactory.getFullName(project.checker)(type)), undefined, typescript_1.default.factory.createBlock(__spreadArray([
|
|
92
96
|
StatementFactory_1.StatementFactory.constant("__is", is),
|
|
93
97
|
typescript_1.default.factory.createIfStatement(typescript_1.default.factory.createStrictEquality(typescript_1.default.factory.createFalse(), typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("__is"), undefined, [typescript_1.default.factory.createIdentifier("input")])), typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(assert, undefined, [
|
|
94
98
|
typescript_1.default.factory.createIdentifier("input"),
|
|
95
99
|
typescript_1.default.factory.createStringLiteral("$input"),
|
|
96
100
|
typescript_1.default.factory.createTrue(),
|
|
97
|
-
])), undefined)
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
])), undefined)
|
|
102
|
+
], __read((props.guard === false
|
|
103
|
+
? [
|
|
104
|
+
typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createIdentifier("input")),
|
|
105
|
+
]
|
|
106
|
+
: [])), false), true));
|
|
100
107
|
};
|
|
101
108
|
};
|
|
102
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssertProgrammer.js","sourceRoot":"","sources":["../../src/programmers/AssertProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,oEAAmE;AACnE,kEAAiE;AACjE,wDAAuD;AAIvD,yDAAwD;AACxD,+CAA8C;AAC9C,iEAA+D;AAC/D,+DAA8D;AAC9D,wDAAuD;AAEvD,IAAiB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"AssertProgrammer.js","sourceRoot":"","sources":["../../src/programmers/AssertProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAE5B,oEAAmE;AACnE,kEAAiE;AACjE,wDAAuD;AAIvD,yDAAwD;AACxD,+CAA8C;AAC9C,iEAA+D;AAC/D,+DAA8D;AAC9D,wDAAuD;AAEvD,IAAiB,gBAAgB,CAuUhC;AAvUD,WAAiB,gBAAgB;IAChB,sBAAK,GACd,UAAC,OAAiB;QAClB,OAAA,UAAC,MAAiC;YAClC,OAAA,UAAC,KAAoD;gBACrD,OAAA,UAAC,IAAa,EAAE,IAAa;oBAEzB,IAAI,OAAO,KAAK,KAAK,SAAS;wBAC1B,KAAK,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;oBAE5C,IAAM,QAAQ,GAAqB,IAAI,oCAAgB,CACnD,MAAM,CAAC,OAAO,EAAE,CACnB,CAAC;oBACF,IAAM,EAAE,GAAG,2BAAY,CAAC,KAAK,CAAC,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oBAAE,CAAC,OAAO,CAAC,UAAU,EAAE;4BACzB,CAAC,CAAC,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CACvB,gBAAgB,CACnB,CACV,CACG,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,EACpC,QAAQ,EACR,KAAK,CACR,CACJ;oBAbD,CAaC,EAdU,CAcV;aACd,CAAC,EAvCiE,CAuCjE;QAvCF,CAuCE;IAxCF,CAwCE,CAAC;IAEP,IAAM,iBAAiB,GACnB,UAAC,QAA0B;QAC3B,OAAA,UAAC,aAA6B;YAC9B,OAAA,UACI,IAAmB,EACnB,QAAgB,EAChB,KAAoB;gBAEpB,OAAA,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE;oBAC9D,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,CAAC;oBAC9D,oBAAE,CAAC,OAAO,CAAC,6BAA6B,CACpC;wBACI,oBAAE,CAAC,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC;wBACjD,oBAAE,CAAC,OAAO,CAAC,wBAAwB,CAC/B,UAAU,EACV,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAC3C;wBACD,oBAAE,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,EAAE,KAAK,CAAC;qBACtD,EACD,IAAI,CACP;iBACJ,CAAC;YAbF,CAaE;QAlBN,CAkBM;IAnBN,CAmBM,CAAC;AACf,CAAC,EAvUgB,gBAAgB,gCAAhB,gBAAgB,QAuUhC"}
|
|
@@ -126,20 +126,44 @@ var CallExpressionTransformer;
|
|
|
126
126
|
})(CallExpressionTransformer || (exports.CallExpressionTransformer = CallExpressionTransformer = {}));
|
|
127
127
|
var FUNCTORS = {
|
|
128
128
|
module: {
|
|
129
|
-
assert: function () {
|
|
130
|
-
|
|
129
|
+
assert: function () {
|
|
130
|
+
return AssertTransformer_1.AssertTransformer.transform({ equals: false, guard: false });
|
|
131
|
+
},
|
|
132
|
+
assertGuard: function () {
|
|
133
|
+
return AssertTransformer_1.AssertTransformer.transform({ equals: false, guard: true });
|
|
134
|
+
},
|
|
135
|
+
assertType: function () {
|
|
136
|
+
return AssertTransformer_1.AssertTransformer.transform({ equals: false, guard: false });
|
|
137
|
+
},
|
|
131
138
|
is: function () { return IsTransformer_1.IsTransformer.transform(false); },
|
|
132
139
|
validate: function () { return ValidateTransformer_1.ValidateTransformer.transform(false); },
|
|
133
|
-
assertEquals: function () {
|
|
140
|
+
assertEquals: function () {
|
|
141
|
+
return AssertTransformer_1.AssertTransformer.transform({ equals: true, guard: false });
|
|
142
|
+
},
|
|
143
|
+
assertGuardEquals: function () {
|
|
144
|
+
return AssertTransformer_1.AssertTransformer.transform({ equals: true, guard: true });
|
|
145
|
+
},
|
|
134
146
|
equals: function () { return IsTransformer_1.IsTransformer.transform(true); },
|
|
135
147
|
validateEquals: function () { return ValidateTransformer_1.ValidateTransformer.transform(true); },
|
|
136
148
|
random: function () { return RandomTransformer_1.RandomTransformer.transform; },
|
|
137
149
|
metadata: function () { return ReflectMetadataTransformer_1.ReflectMetadataTransformer.transform; },
|
|
138
|
-
createAssert: function () {
|
|
139
|
-
|
|
150
|
+
createAssert: function () {
|
|
151
|
+
return CreateAssertTransformer_1.CreateAssertTransformer.transform({ equals: false, guard: false });
|
|
152
|
+
},
|
|
153
|
+
createAssertGuard: function () {
|
|
154
|
+
return CreateAssertTransformer_1.CreateAssertTransformer.transform({ equals: false, guard: true });
|
|
155
|
+
},
|
|
156
|
+
createAssertType: function () {
|
|
157
|
+
return CreateAssertTransformer_1.CreateAssertTransformer.transform({ equals: false, guard: false });
|
|
158
|
+
},
|
|
140
159
|
createIs: function () { return CreateIsTransformer_1.CreateIsTransformer.transform(false); },
|
|
141
160
|
createValidate: function () { return CreateValidateTransformer_1.CreateValidateTransformer.transform(false); },
|
|
142
|
-
createAssertEquals: function () {
|
|
161
|
+
createAssertEquals: function () {
|
|
162
|
+
return CreateAssertTransformer_1.CreateAssertTransformer.transform({ equals: true, guard: false });
|
|
163
|
+
},
|
|
164
|
+
createAssertGuardEquals: function () {
|
|
165
|
+
return CreateAssertTransformer_1.CreateAssertTransformer.transform({ equals: true, guard: true });
|
|
166
|
+
},
|
|
143
167
|
createEquals: function () { return CreateIsTransformer_1.CreateIsTransformer.transform(true); },
|
|
144
168
|
createValidateEquals: function () { return CreateValidateTransformer_1.CreateValidateTransformer.transform(true); },
|
|
145
169
|
createRandom: function () { return CreateRandomTransformer_1.CreateRandomTransformer.transform; },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallExpressionTransformer.js","sourceRoot":"","sources":["../../src/transformers/CallExpressionTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AAGxB,8DAA6D;AAG7D,kEAAiE;AACjE,8EAA6E;AAC7E,sEAAqE;AACrE,8EAA6E;AAC7E,kFAAiF;AACjF,0DAAyD;AACzD,kEAAiE;AACjE,sEAAqE;AACrE,yGAAwG;AACxG,qGAAoG;AACpG,6FAA4F;AAC5F,iGAAgG;AAChG,6FAA4F;AAC5F,iGAAgG;AAChG,yFAAwF;AACxF,6GAA4G;AAC5G,yGAAwG;AACxG,6FAA4F;AAC5F,yFAAwF;AACxF,iFAAgF;AAChF,qFAAoF;AACpF,iFAAgF;AAChF,qFAAoF;AACpF,6EAA4E;AAC5E,iGAAgG;AAChG,6FAA4F;AAC5F,yFAAwF;AACxF,yFAAwF;AACxF,iGAAgG;AAChG,qGAAoG;AACpG,6GAA4G;AAC5G,6FAA4F;AAC5F,qGAAoG;AACpG,iGAAgG;AAChG,yGAAwG;AACxG,+GAA+G;AAC/G,iFAAgF;AAChF,yFAAwF;AACxF,qFAAoF;AACpF,6FAA4F;AAC5F,qGAAoG;AACpG,yFAAwF;AACxF,yFAAwF;AACxF,6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;QACL,aAAa,EAAE;YACX,OAAA,uEAAkC,CAAC,SAAS,CACxC,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,mBAAmB,EAAE;YACjB,OAAA,mFAAwC,CAAC,SAAS,CAC9C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,YAAY,EAAE;YACV,OAAA,mEAAgC,CAAC,SAAS,CAAC,mCAAgB,CAAC,MAAM,CAAC;QAAnE,CAAmE;QACvE,kBAAkB,EAAE;YAChB,OAAA,+EAAsC,CAAC,SAAS,CAC5C,mCAAgB,CAAC,MAAM,CAC1B;QAFD,CAEC;QACL,cAAc,EAAE;YACZ,OAAA,uEAAkC,CAAC,SAAS,CACxC,mCAAgB,CAAC,MAAM,CAC1B;QAFD,CAEC;QACL,oBAAoB,EAAE;YAClB,OAAA,mFAAwC,CAAC,SAAS,CAC9C,mCAAgB,CAAC,MAAM,CAC1B;QAFD,CAEC;QACL,WAAW,EAAE;YACT,OAAA,mEAAgC,CAAC,SAAS,CAAC,mCAAgB,CAAC,KAAK,CAAC;QAAlE,CAAkE;QACtE,iBAAiB,EAAE;YACf,OAAA,+EAAsC,CAAC,SAAS,CAC5C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,aAAa,EAAE;YACX,OAAA,uEAAkC,CAAC,SAAS,CACxC,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,mBAAmB,EAAE;YACjB,OAAA,mFAAwC,CAAC,SAAS,CAC9C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;KACR;CACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"CallExpressionTransformer.js","sourceRoot":"","sources":["../../src/transformers/CallExpressionTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AAGxB,8DAA6D;AAG7D,kEAAiE;AACjE,8EAA6E;AAC7E,sEAAqE;AACrE,8EAA6E;AAC7E,kFAAiF;AACjF,0DAAyD;AACzD,kEAAiE;AACjE,sEAAqE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AlE,CAAkE;QACtE,iBAAiB,EAAE;YACf,OAAA,+EAAsC,CAAC,SAAS,CAC5C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,aAAa,EAAE;YACX,OAAA,uEAAkC,CAAC,SAAS,CACxC,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,mBAAmB,EAAE;YACjB,OAAA,mFAAwC,CAAC,SAAS,CAC9C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,YAAY,EAAE;YACV,OAAA,mEAAgC,CAAC,SAAS,CAAC,mCAAgB,CAAC,MAAM,CAAC;QAAnE,CAAmE;QACvE,kBAAkB,EAAE;YAChB,OAAA,+EAAsC,CAAC,SAAS,CAC5C,mCAAgB,CAAC,MAAM,CAC1B;QAFD,CAEC;QACL,cAAc,EAAE;YACZ,OAAA,uEAAkC,CAAC,SAAS,CACxC,mCAAgB,CAAC,MAAM,CAC1B;QAFD,CAEC;QACL,oBAAoB,EAAE;YAClB,OAAA,mFAAwC,CAAC,SAAS,CAC9C,mCAAgB,CAAC,MAAM,CAC1B;QAFD,CAEC;QACL,WAAW,EAAE;YACT,OAAA,mEAAgC,CAAC,SAAS,CAAC,mCAAgB,CAAC,KAAK,CAAC;QAAlE,CAAkE;QACtE,iBAAiB,EAAE;YACf,OAAA,+EAAsC,CAAC,SAAS,CAC5C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,aAAa,EAAE;YACX,OAAA,uEAAkC,CAAC,SAAS,CACxC,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;QACL,mBAAmB,EAAE;YACjB,OAAA,mFAAwC,CAAC,SAAS,CAC9C,mCAAgB,CAAC,KAAK,CACzB;QAFD,CAEC;KACR;CACJ,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="ts-expose-internals/typescript" />
|
|
2
2
|
export declare namespace AssertTransformer {
|
|
3
|
-
const transform: (
|
|
3
|
+
const transform: (props: {
|
|
4
|
+
equals: boolean;
|
|
5
|
+
guard: boolean;
|
|
6
|
+
}) => (project: import("../IProject").IProject) => (modulo: import("typescript").LeftHandSideExpression) => (expression: import("typescript").CallExpression) => import("typescript").CallExpression;
|
|
4
7
|
}
|
|
@@ -5,9 +5,15 @@ var AssertProgrammer_1 = require("../../programmers/AssertProgrammer");
|
|
|
5
5
|
var GenericTransformer_1 = require("../internal/GenericTransformer");
|
|
6
6
|
var AssertTransformer;
|
|
7
7
|
(function (AssertTransformer) {
|
|
8
|
-
AssertTransformer.transform = function (
|
|
9
|
-
return GenericTransformer_1.GenericTransformer.scalar(equals
|
|
10
|
-
|
|
8
|
+
AssertTransformer.transform = function (props) {
|
|
9
|
+
return GenericTransformer_1.GenericTransformer.scalar(props.equals
|
|
10
|
+
? props.guard
|
|
11
|
+
? "assertGuardEquals"
|
|
12
|
+
: "assertEquals"
|
|
13
|
+
: props.guard
|
|
14
|
+
? "assertGuard"
|
|
15
|
+
: "assert")(function (project) { return function (modulo) {
|
|
16
|
+
return AssertProgrammer_1.AssertProgrammer.write(project)(modulo)(props);
|
|
11
17
|
}; });
|
|
12
18
|
};
|
|
13
19
|
})(AssertTransformer || (exports.AssertTransformer = AssertTransformer = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssertTransformer.js","sourceRoot":"","sources":["../../../src/transformers/features/AssertTransformer.ts"],"names":[],"mappings":";;;AAAA,uEAAsE;AAEtE,qEAAoE;AAEpE,IAAiB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AssertTransformer.js","sourceRoot":"","sources":["../../../src/transformers/features/AssertTransformer.ts"],"names":[],"mappings":";;;AAAA,uEAAsE;AAEtE,qEAAoE;AAEpE,IAAiB,iBAAiB,CAcjC;AAdD,WAAiB,iBAAiB;IACjB,2BAAS,GAAG,UAAC,KAA0C;QAChE,OAAA,uCAAkB,CAAC,MAAM,CACrB,KAAK,CAAC,MAAM;YACR,CAAC,CAAC,KAAK,CAAC,KAAK;gBACT,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,cAAc;YACpB,CAAC,CAAC,KAAK,CAAC,KAAK;gBACb,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,QAAQ,CACjB,CACG,UAAC,OAAO,IAAK,OAAA,UAAC,MAAM;YAChB,OAAA,mCAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;QAA9C,CAA8C,EADrC,CACqC,CACrD;IAXD,CAWC,CAAC;AACV,CAAC,EAdgB,iBAAiB,iCAAjB,iBAAiB,QAcjC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="ts-expose-internals/typescript" />
|
|
2
2
|
export declare namespace CreateAssertTransformer {
|
|
3
|
-
const transform: (
|
|
3
|
+
const transform: (props: {
|
|
4
|
+
equals: boolean;
|
|
5
|
+
guard: boolean;
|
|
6
|
+
}) => (project: import("../IProject").IProject) => (modulo: import("typescript").LeftHandSideExpression) => (expression: import("typescript").CallExpression) => import("typescript").ArrowFunction;
|
|
4
7
|
}
|
|
@@ -5,9 +5,15 @@ var AssertProgrammer_1 = require("../../programmers/AssertProgrammer");
|
|
|
5
5
|
var GenericTransformer_1 = require("../internal/GenericTransformer");
|
|
6
6
|
var CreateAssertTransformer;
|
|
7
7
|
(function (CreateAssertTransformer) {
|
|
8
|
-
CreateAssertTransformer.transform = function (
|
|
9
|
-
return GenericTransformer_1.GenericTransformer.factory(equals
|
|
10
|
-
|
|
8
|
+
CreateAssertTransformer.transform = function (props) {
|
|
9
|
+
return GenericTransformer_1.GenericTransformer.factory(props.equals
|
|
10
|
+
? props.guard
|
|
11
|
+
? "createAssertGuardEquals"
|
|
12
|
+
: "createAssertEquals"
|
|
13
|
+
: props.guard
|
|
14
|
+
? "createAssertGuard"
|
|
15
|
+
: "createAssert")(function (project) { return function (modulo) {
|
|
16
|
+
return AssertProgrammer_1.AssertProgrammer.write(project)(modulo)(props);
|
|
11
17
|
}; });
|
|
12
18
|
};
|
|
13
19
|
})(CreateAssertTransformer || (exports.CreateAssertTransformer = CreateAssertTransformer = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAssertTransformer.js","sourceRoot":"","sources":["../../../src/transformers/features/CreateAssertTransformer.ts"],"names":[],"mappings":";;;AAAA,uEAAsE;AAEtE,qEAAoE;AAEpE,IAAiB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"CreateAssertTransformer.js","sourceRoot":"","sources":["../../../src/transformers/features/CreateAssertTransformer.ts"],"names":[],"mappings":";;;AAAA,uEAAsE;AAEtE,qEAAoE;AAEpE,IAAiB,uBAAuB,CAcvC;AAdD,WAAiB,uBAAuB;IACvB,iCAAS,GAAG,UAAC,KAA0C;QAChE,OAAA,uCAAkB,CAAC,OAAO,CACtB,KAAK,CAAC,MAAM;YACR,CAAC,CAAC,KAAK,CAAC,KAAK;gBACT,CAAC,CAAC,yBAAyB;gBAC3B,CAAC,CAAC,oBAAoB;YAC1B,CAAC,CAAC,KAAK,CAAC,KAAK;gBACb,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,cAAc,CACvB,CACG,UAAC,OAAO,IAAK,OAAA,UAAC,MAAM;YAChB,OAAA,mCAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;QAA9C,CAA8C,EADrC,CACqC,CACrD;IAXD,CAWC,CAAC;AACV,CAAC,EAdgB,uBAAuB,uCAAvB,uBAAuB,QAcvC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AssertionGuard<T> = (input: unknown) => asserts input is T;
|
package/src/module.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Namespace } from "./functional/Namespace";
|
|
2
2
|
|
|
3
|
+
import { AssertionGuard } from "./AssertionGuard";
|
|
3
4
|
import { IRandomGenerator } from "./IRandomGenerator";
|
|
4
5
|
import { IValidation } from "./IValidation";
|
|
5
6
|
import { Resolved } from "./Resolved";
|
|
@@ -15,6 +16,7 @@ export * as tags from "./tags";
|
|
|
15
16
|
export * from "./schemas/json/IJsonApplication";
|
|
16
17
|
export * from "./schemas/json/IJsonComponents";
|
|
17
18
|
export * from "./schemas/json/IJsonSchema";
|
|
19
|
+
export * from "./AssertionGuard";
|
|
18
20
|
export * from "./IRandomGenerator";
|
|
19
21
|
export * from "./IValidation";
|
|
20
22
|
export * from "./TypeGuardError";
|
|
@@ -38,6 +40,8 @@ export * from "./SnakeCase";
|
|
|
38
40
|
* If what you want is not asserting but just knowing whether the parametric value is
|
|
39
41
|
* following the type `T` or not, you can choose the {@link is} function instead.
|
|
40
42
|
* Otherwise you want to know all the errors, {@link validate} is the way to go.
|
|
43
|
+
* Also, if you want to automatically cast the parametric value to the type `T`
|
|
44
|
+
* when no problem (perform the assertion guard of type).
|
|
41
45
|
*
|
|
42
46
|
* On the other and, if you don't want to allow any superfluous property that is not
|
|
43
47
|
* enrolled to the type `T`, you can use {@link assertEquals} function instead.
|
|
@@ -82,6 +86,66 @@ export function assert(): never {
|
|
|
82
86
|
}
|
|
83
87
|
Object.assign(assert, Namespace.assert("assert"));
|
|
84
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Assertion guard of a value type.
|
|
91
|
+
*
|
|
92
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
93
|
+
* reason, if the parametric value is not following the type `T`. Otherwise, the
|
|
94
|
+
* value is following the type `T`, nothing would be returned, but the input value
|
|
95
|
+
* would be automatically casted to the type `T`. This is the concept of
|
|
96
|
+
* "assertion guard" of a value type.
|
|
97
|
+
*
|
|
98
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
99
|
+
* following the type `T` or not, you can choose the {@link is} function instead.
|
|
100
|
+
* Otherwise you want to know all the errors, {@link validate} is the way to go.
|
|
101
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
102
|
+
* {@link assert} function instead.
|
|
103
|
+
*
|
|
104
|
+
* On the other and, if you don't want to allow any superfluous property that is not
|
|
105
|
+
* enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
|
|
106
|
+
*
|
|
107
|
+
* @template T Type of the input value
|
|
108
|
+
* @param input A value to be asserted
|
|
109
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
110
|
+
*
|
|
111
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
112
|
+
*/
|
|
113
|
+
export function assertGuard<T>(input: T): asserts input is T;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Assertion guard of a value type.
|
|
117
|
+
*
|
|
118
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
119
|
+
* reason, if the parametric value is not following the type `T`. Otherwise, the
|
|
120
|
+
* value is following the type `T`, nothing would be returned, but the input value
|
|
121
|
+
* would be automatically casted to the type `T`. This is the concept of
|
|
122
|
+
* "assertion guard" of a value type.
|
|
123
|
+
*
|
|
124
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
125
|
+
* following the type `T` or not, you can choose the {@link is} function instead.
|
|
126
|
+
* Otherwise you want to know all the errors, {@link validate} is the way to go.
|
|
127
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
128
|
+
* {@link assert} function instead.
|
|
129
|
+
*
|
|
130
|
+
* On the other and, if you don't want to allow any superfluous property that is not
|
|
131
|
+
* enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.
|
|
132
|
+
*
|
|
133
|
+
* @template T Type of the input value
|
|
134
|
+
* @param input A value to be asserted
|
|
135
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
136
|
+
*
|
|
137
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
138
|
+
*/
|
|
139
|
+
export function assertGuard<T>(input: unknown): asserts input is T;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
export function assertGuard(): never {
|
|
145
|
+
halt("assertGuard");
|
|
146
|
+
}
|
|
147
|
+
Object.assign(assertGuard, Namespace.assert("assertGuard"));
|
|
148
|
+
|
|
85
149
|
/**
|
|
86
150
|
* Tests a value type.
|
|
87
151
|
*
|
|
@@ -257,6 +321,72 @@ export function assertEquals(): never {
|
|
|
257
321
|
}
|
|
258
322
|
Object.assign(assertEquals, Namespace.assert("assertEquals"));
|
|
259
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Assertion guard of a type with equality.
|
|
326
|
+
*
|
|
327
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
328
|
+
* reason, if the parametric value is not following the type `T` or some superfluous
|
|
329
|
+
* property that is not listed on the type `T` has been found.
|
|
330
|
+
*
|
|
331
|
+
* Otherwise, the value is following the type `T` without any superfluous property,
|
|
332
|
+
* nothing would be returned, but the input value would be automatically casted to
|
|
333
|
+
* the type `T`. This is the concept of "assertion guard" of a value type.
|
|
334
|
+
*
|
|
335
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
336
|
+
* following the type `T` or not, you can choose the {@link equals} function instead.
|
|
337
|
+
* Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
|
|
338
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
339
|
+
* {@link assert} function instead.
|
|
340
|
+
*
|
|
341
|
+
* On the other hand, if you want to allow superfluous property that is not enrolled
|
|
342
|
+
* to the type `T`, you can use {@link assertEquals} function instead.
|
|
343
|
+
*
|
|
344
|
+
* @template T Type of the input value
|
|
345
|
+
* @param input A value to be asserted
|
|
346
|
+
* @returns Parametric input value casted as `T`
|
|
347
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
348
|
+
*
|
|
349
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
350
|
+
*/
|
|
351
|
+
export function assertGuardEquals<T>(input: T): asserts input is T;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Assertion guard of a type with equality.
|
|
355
|
+
*
|
|
356
|
+
* Asserts a parametric value type and throws a {@link TypeGuardError} with detailed
|
|
357
|
+
* reason, if the parametric value is not following the type `T` or some superfluous
|
|
358
|
+
* property that is not listed on the type `T` has been found.
|
|
359
|
+
*
|
|
360
|
+
* Otherwise, the value is following the type `T` without any superfluous property,
|
|
361
|
+
* nothing would be returned, but the input value would be automatically casted to
|
|
362
|
+
* the type `T`. This is the concept of "assertion guard" of a value type.
|
|
363
|
+
*
|
|
364
|
+
* If what you want is not asserting but just knowing whether the parametric value is
|
|
365
|
+
* following the type `T` or not, you can choose the {@link equals} function instead.
|
|
366
|
+
* Otherwise, you want to know all the errors, {@link validateEquals} is the way to go.
|
|
367
|
+
* Also, if you want to returns the parametric value when no problem, you can use
|
|
368
|
+
* {@link assertEquals} function instead.
|
|
369
|
+
*
|
|
370
|
+
* On the other hand, if you want to allow superfluous property that is not enrolled
|
|
371
|
+
* to the type `T`, you can use {@link assertGuard} function instead.
|
|
372
|
+
*
|
|
373
|
+
* @template T Type of the input value
|
|
374
|
+
* @param input A value to be asserted
|
|
375
|
+
* @returns Parametric input value casted as `T`
|
|
376
|
+
* @throws A {@link TypeGuardError} instance with detailed reason
|
|
377
|
+
*
|
|
378
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
379
|
+
*/
|
|
380
|
+
export function assertGuardEquals<T>(input: unknown): asserts input is T;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @internal
|
|
384
|
+
*/
|
|
385
|
+
export function assertGuardEquals(): never {
|
|
386
|
+
halt("assertGuardEquals");
|
|
387
|
+
}
|
|
388
|
+
Object.assign(assertGuardEquals, Namespace.assert("assertGuardEquals"));
|
|
389
|
+
|
|
260
390
|
/**
|
|
261
391
|
* Tests equality between a value and its type.
|
|
262
392
|
*
|
|
@@ -456,6 +586,65 @@ export function createAssert<T>(): (input: unknown) => T {
|
|
|
456
586
|
}
|
|
457
587
|
Object.assign(createAssert, assert);
|
|
458
588
|
|
|
589
|
+
/**
|
|
590
|
+
* Creates a reusable {@link assertGuard} function.
|
|
591
|
+
*
|
|
592
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
593
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
594
|
+
* This is the special rule of the TypeScript compiler.
|
|
595
|
+
*
|
|
596
|
+
* ```typescript
|
|
597
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
598
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
|
|
599
|
+
*
|
|
600
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
601
|
+
* const func = typia.createAssertGuard<number>();
|
|
602
|
+
* ```
|
|
603
|
+
*
|
|
604
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
605
|
+
* > *explicit type annotation.*
|
|
606
|
+
*
|
|
607
|
+
* @danger You must configure the generic argument `T`
|
|
608
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
609
|
+
* @throws compile error
|
|
610
|
+
*
|
|
611
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
612
|
+
*/
|
|
613
|
+
export function createAssertGuard(): never;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Creates a reusable {@link assertGuard} function.
|
|
617
|
+
*
|
|
618
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
619
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
620
|
+
* This is the special rule of the TypeScript compiler.
|
|
621
|
+
*
|
|
622
|
+
* ```typescript
|
|
623
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
624
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuard<number>();
|
|
625
|
+
*
|
|
626
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
627
|
+
* const func = typia.createAssertGuard<number>();
|
|
628
|
+
* ```
|
|
629
|
+
*
|
|
630
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
631
|
+
* > *explicit type annotation.*
|
|
632
|
+
*
|
|
633
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
634
|
+
* @throws compile error
|
|
635
|
+
*
|
|
636
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
637
|
+
*/
|
|
638
|
+
export function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T>;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* @internal
|
|
642
|
+
*/
|
|
643
|
+
export function createAssertGuard<T>(): (input: unknown) => AssertionGuard<T> {
|
|
644
|
+
halt("createAssertGuard");
|
|
645
|
+
}
|
|
646
|
+
Object.assign(createAssertGuard, assertGuard);
|
|
647
|
+
|
|
459
648
|
/**
|
|
460
649
|
* Creates a reusable {@link is} function.
|
|
461
650
|
*
|
|
@@ -543,6 +732,69 @@ export function createAssertEquals<T>(): (input: unknown) => T {
|
|
|
543
732
|
}
|
|
544
733
|
Object.assign(createAssertEquals, assertEquals);
|
|
545
734
|
|
|
735
|
+
/**
|
|
736
|
+
* Creates a reusable {@link assertGuardEquals} function.
|
|
737
|
+
*
|
|
738
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
739
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
740
|
+
* This is the special rule of the TypeScript compiler.
|
|
741
|
+
*
|
|
742
|
+
* ```typescript
|
|
743
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
744
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
|
|
745
|
+
*
|
|
746
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
747
|
+
* const func = typia.createAssertGuardEquals<number>();
|
|
748
|
+
* ```
|
|
749
|
+
*
|
|
750
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
751
|
+
* > *explicit type annotation.*
|
|
752
|
+
*
|
|
753
|
+
* @danger You must configure the generic argument `T`
|
|
754
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
755
|
+
* @throws compile error
|
|
756
|
+
*
|
|
757
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
758
|
+
*/
|
|
759
|
+
export function createAssertGuardEquals(): never;
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Creates a reusable {@link assertGuardEquals} function.
|
|
763
|
+
*
|
|
764
|
+
* Note that, you've to declare the variable type of the factory function caller
|
|
765
|
+
* like below. If you don't declare the variable type, compilation error be thrown.
|
|
766
|
+
* This is the special rule of the TypeScript compiler.
|
|
767
|
+
*
|
|
768
|
+
* ```typescript
|
|
769
|
+
* // MUST DECLARE THE VARIABLE TYPE
|
|
770
|
+
* const func: typia.AssertionGuard<number> = typia.createAssertGuardEquals<number>();
|
|
771
|
+
*
|
|
772
|
+
* // IF NOT, COMPILATION ERROR BE OCCURED
|
|
773
|
+
* const func = typia.createAssertGuardEquals<number>();
|
|
774
|
+
* ```
|
|
775
|
+
*
|
|
776
|
+
* > *Assertions require every name in the call target to be declared with an*
|
|
777
|
+
* > *explicit type annotation.*
|
|
778
|
+
*
|
|
779
|
+
* @returns Nothing until you configure the generic argument `T`
|
|
780
|
+
* @throws compile error
|
|
781
|
+
*
|
|
782
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
783
|
+
*/
|
|
784
|
+
export function createAssertGuardEquals<T>(): (
|
|
785
|
+
input: unknown,
|
|
786
|
+
) => AssertionGuard<T>;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* @internal
|
|
790
|
+
*/
|
|
791
|
+
export function createAssertGuardEquals<T>(): (
|
|
792
|
+
input: unknown,
|
|
793
|
+
) => AssertionGuard<T> {
|
|
794
|
+
halt("createAssertGuardEquals");
|
|
795
|
+
}
|
|
796
|
+
Object.assign(createAssertGuardEquals, assertGuardEquals);
|
|
797
|
+
|
|
546
798
|
/**
|
|
547
799
|
* Creates a reusable {@link equals} function.
|
|
548
800
|
*
|
|
@@ -16,12 +16,16 @@ export namespace AssertProgrammer {
|
|
|
16
16
|
export const write =
|
|
17
17
|
(project: IProject) =>
|
|
18
18
|
(modulo: ts.LeftHandSideExpression) =>
|
|
19
|
-
(equals: boolean) =>
|
|
19
|
+
(props: boolean | { equals: boolean; guard: boolean }) =>
|
|
20
20
|
(type: ts.Type, name?: string) => {
|
|
21
|
+
// TO SUPPORT LEGACY FEATURE
|
|
22
|
+
if (typeof props === "boolean")
|
|
23
|
+
props = { equals: props, guard: false };
|
|
24
|
+
|
|
21
25
|
const importer: FunctionImporter = new FunctionImporter(
|
|
22
26
|
modulo.getText(),
|
|
23
27
|
);
|
|
24
|
-
const is = IsProgrammer.write(project)(modulo, true)(equals)(
|
|
28
|
+
const is = IsProgrammer.write(project)(modulo, true)(props.equals)(
|
|
25
29
|
type,
|
|
26
30
|
name ?? TypeFactory.getFullName(project.checker)(type),
|
|
27
31
|
);
|
|
@@ -30,7 +34,7 @@ export namespace AssertProgrammer {
|
|
|
30
34
|
path: true,
|
|
31
35
|
trace: true,
|
|
32
36
|
numeric: OptionPredicator.numeric(project.options),
|
|
33
|
-
equals,
|
|
37
|
+
equals: props.equals,
|
|
34
38
|
atomist: (explore) => (entry) => (input) =>
|
|
35
39
|
[
|
|
36
40
|
...(entry.expression ? [entry.expression] : []),
|
|
@@ -91,8 +95,8 @@ export namespace AssertProgrammer {
|
|
|
91
95
|
),
|
|
92
96
|
]),
|
|
93
97
|
].reduce((x, y) => ts.factory.createLogicalAnd(x, y)),
|
|
94
|
-
combiner: combiner(equals)(project)(importer),
|
|
95
|
-
joiner: joiner(equals)(project)(importer),
|
|
98
|
+
combiner: combiner(props.equals)(project)(importer),
|
|
99
|
+
joiner: joiner(props.equals)(project)(importer),
|
|
96
100
|
success: ts.factory.createTrue(),
|
|
97
101
|
addition: () => importer.declare(modulo),
|
|
98
102
|
})(importer)(type, name);
|
|
@@ -106,9 +110,21 @@ export namespace AssertProgrammer {
|
|
|
106
110
|
TypeFactory.keyword("any"),
|
|
107
111
|
),
|
|
108
112
|
],
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
props.guard
|
|
114
|
+
? ts.factory.createTypePredicateNode(
|
|
115
|
+
ts.factory.createToken(ts.SyntaxKind.AssertsKeyword),
|
|
116
|
+
ts.factory.createIdentifier("input"),
|
|
117
|
+
ts.factory.createTypeReferenceNode(
|
|
118
|
+
name ??
|
|
119
|
+
TypeFactory.getFullName(project.checker)(
|
|
120
|
+
type,
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
: ts.factory.createTypeReferenceNode(
|
|
125
|
+
name ??
|
|
126
|
+
TypeFactory.getFullName(project.checker)(type),
|
|
127
|
+
),
|
|
112
128
|
undefined,
|
|
113
129
|
ts.factory.createBlock(
|
|
114
130
|
[
|
|
@@ -137,9 +153,13 @@ export namespace AssertProgrammer {
|
|
|
137
153
|
),
|
|
138
154
|
undefined,
|
|
139
155
|
),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
156
|
+
...(props.guard === false
|
|
157
|
+
? [
|
|
158
|
+
ts.factory.createReturnStatement(
|
|
159
|
+
ts.factory.createIdentifier(`input`),
|
|
160
|
+
),
|
|
161
|
+
]
|
|
162
|
+
: []),
|
|
143
163
|
],
|
|
144
164
|
true,
|
|
145
165
|
),
|
|
@@ -162,13 +162,20 @@ type Task = (
|
|
|
162
162
|
const FUNCTORS: Record<string, Record<string, () => Task>> = {
|
|
163
163
|
module: {
|
|
164
164
|
// BASIC
|
|
165
|
-
assert: () =>
|
|
166
|
-
|
|
165
|
+
assert: () =>
|
|
166
|
+
AssertTransformer.transform({ equals: false, guard: false }),
|
|
167
|
+
assertGuard: () =>
|
|
168
|
+
AssertTransformer.transform({ equals: false, guard: true }),
|
|
169
|
+
assertType: () =>
|
|
170
|
+
AssertTransformer.transform({ equals: false, guard: false }),
|
|
167
171
|
is: () => IsTransformer.transform(false),
|
|
168
172
|
validate: () => ValidateTransformer.transform(false),
|
|
169
173
|
|
|
170
174
|
// STRICT
|
|
171
|
-
assertEquals: () =>
|
|
175
|
+
assertEquals: () =>
|
|
176
|
+
AssertTransformer.transform({ equals: true, guard: false }),
|
|
177
|
+
assertGuardEquals: () =>
|
|
178
|
+
AssertTransformer.transform({ equals: true, guard: true }),
|
|
172
179
|
equals: () => IsTransformer.transform(true),
|
|
173
180
|
validateEquals: () => ValidateTransformer.transform(true),
|
|
174
181
|
|
|
@@ -177,11 +184,18 @@ const FUNCTORS: Record<string, Record<string, () => Task>> = {
|
|
|
177
184
|
metadata: () => ReflectMetadataTransformer.transform,
|
|
178
185
|
|
|
179
186
|
// FACTORIES
|
|
180
|
-
createAssert: () =>
|
|
181
|
-
|
|
187
|
+
createAssert: () =>
|
|
188
|
+
CreateAssertTransformer.transform({ equals: false, guard: false }),
|
|
189
|
+
createAssertGuard: () =>
|
|
190
|
+
CreateAssertTransformer.transform({ equals: false, guard: true }),
|
|
191
|
+
createAssertType: () =>
|
|
192
|
+
CreateAssertTransformer.transform({ equals: false, guard: false }),
|
|
182
193
|
createIs: () => CreateIsTransformer.transform(false),
|
|
183
194
|
createValidate: () => CreateValidateTransformer.transform(false),
|
|
184
|
-
createAssertEquals: () =>
|
|
195
|
+
createAssertEquals: () =>
|
|
196
|
+
CreateAssertTransformer.transform({ equals: true, guard: false }),
|
|
197
|
+
createAssertGuardEquals: () =>
|
|
198
|
+
CreateAssertTransformer.transform({ equals: true, guard: true }),
|
|
185
199
|
createEquals: () => CreateIsTransformer.transform(true),
|
|
186
200
|
createValidateEquals: () => CreateValidateTransformer.transform(true),
|
|
187
201
|
createRandom: () => CreateRandomTransformer.transform,
|
|
@@ -3,9 +3,17 @@ import { AssertProgrammer } from "../../programmers/AssertProgrammer";
|
|
|
3
3
|
import { GenericTransformer } from "../internal/GenericTransformer";
|
|
4
4
|
|
|
5
5
|
export namespace AssertTransformer {
|
|
6
|
-
export const transform = (equals: boolean) =>
|
|
7
|
-
GenericTransformer.scalar(
|
|
6
|
+
export const transform = (props: { equals: boolean; guard: boolean }) =>
|
|
7
|
+
GenericTransformer.scalar(
|
|
8
|
+
props.equals
|
|
9
|
+
? props.guard
|
|
10
|
+
? "assertGuardEquals"
|
|
11
|
+
: "assertEquals"
|
|
12
|
+
: props.guard
|
|
13
|
+
? "assertGuard"
|
|
14
|
+
: "assert",
|
|
15
|
+
)(
|
|
8
16
|
(project) => (modulo) =>
|
|
9
|
-
AssertProgrammer.write(project)(modulo)(
|
|
17
|
+
AssertProgrammer.write(project)(modulo)(props),
|
|
10
18
|
);
|
|
11
19
|
}
|
|
@@ -3,11 +3,17 @@ import { AssertProgrammer } from "../../programmers/AssertProgrammer";
|
|
|
3
3
|
import { GenericTransformer } from "../internal/GenericTransformer";
|
|
4
4
|
|
|
5
5
|
export namespace CreateAssertTransformer {
|
|
6
|
-
export const transform = (equals: boolean) =>
|
|
6
|
+
export const transform = (props: { equals: boolean; guard: boolean }) =>
|
|
7
7
|
GenericTransformer.factory(
|
|
8
|
-
equals
|
|
8
|
+
props.equals
|
|
9
|
+
? props.guard
|
|
10
|
+
? "createAssertGuardEquals"
|
|
11
|
+
: "createAssertEquals"
|
|
12
|
+
: props.guard
|
|
13
|
+
? "createAssertGuard"
|
|
14
|
+
: "createAssert",
|
|
9
15
|
)(
|
|
10
16
|
(project) => (modulo) =>
|
|
11
|
-
AssertProgrammer.write(project)(modulo)(
|
|
17
|
+
AssertProgrammer.write(project)(modulo)(props),
|
|
12
18
|
);
|
|
13
19
|
}
|