typia 5.5.0-dev.20240303-3 → 5.5.0-dev.20240304
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/functional/Namespace/functional.d.ts +4 -0
- package/lib/functional/Namespace/functional.js +9 -0
- package/lib/functional/Namespace/functional.js.map +1 -0
- package/lib/functional/Namespace/index.d.ts +1 -0
- package/lib/functional/Namespace/index.js +2 -1
- package/lib/functional/Namespace/index.js.map +1 -1
- package/lib/functional.d.ts +6 -162
- package/lib/functional.js +248 -48
- package/lib/functional.js.map +1 -1
- package/lib/programmers/AssertProgrammer.js +2 -2
- package/lib/programmers/AssertProgrammer.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.d.ts +1 -1
- package/lib/programmers/FeatureProgrammer.d.ts +1 -1
- package/lib/programmers/IsProgrammer.d.ts +1 -1
- package/lib/programmers/IsProgrammer.js +3 -3
- package/lib/programmers/IsProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +2 -2
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/ValidateProgrammer.js +2 -2
- package/lib/programmers/ValidateProgrammer.js.map +1 -1
- package/lib/programmers/functional/FunctionalAssertFunctionProgrammer.d.ts +2 -0
- package/lib/programmers/functional/FunctionalAssertFunctionProgrammer.js +55 -11
- package/lib/programmers/functional/FunctionalAssertFunctionProgrammer.js.map +1 -1
- package/lib/programmers/functional/FunctionalAssertParametersProgrammer.d.ts +1 -5
- package/lib/programmers/functional/FunctionalAssertParametersProgrammer.js +38 -21
- package/lib/programmers/functional/FunctionalAssertParametersProgrammer.js.map +1 -1
- package/lib/programmers/functional/FunctionalAssertReturnProgrammer.d.ts +1 -5
- package/lib/programmers/functional/FunctionalAssertReturnProgrammer.js +17 -18
- package/lib/programmers/functional/FunctionalAssertReturnProgrammer.js.map +1 -1
- package/lib/programmers/helpers/FunctionImporeter.d.ts +1 -19
- package/lib/programmers/helpers/FunctionImporeter.js +13 -91
- package/lib/programmers/helpers/FunctionImporeter.js.map +1 -1
- package/lib/programmers/helpers/FunctionImporter.d.ts +19 -0
- package/lib/programmers/helpers/FunctionImporter.js +96 -0
- package/lib/programmers/helpers/FunctionImporter.js.map +1 -0
- package/lib/programmers/helpers/StringifyJoinder.d.ts +1 -1
- package/lib/programmers/helpers/disable_function_importer_declare.d.ts +1 -1
- package/lib/programmers/http/HttpFormDataProgrammer.js +2 -2
- package/lib/programmers/http/HttpFormDataProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpHeadersProgrammer.js +2 -2
- package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpParameterProgrammer.js +2 -2
- package/lib/programmers/http/HttpParameterProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpQueryProgrammer.js +2 -2
- package/lib/programmers/http/HttpQueryProgrammer.js.map +1 -1
- package/lib/programmers/internal/check_dynamic_key.d.ts +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.js +2 -2
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js +2 -2
- package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js +2 -2
- package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js +2 -2
- package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +2 -2
- package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +2 -2
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
- package/lib/transformers/features/functional/FunctionalGenericTransformer.js +10 -31
- package/lib/transformers/features/functional/FunctionalGenericTransformer.js.map +1 -1
- package/package.json +2 -1
- package/src/functional/Namespace/functional.ts +5 -0
- package/src/functional/Namespace/index.ts +1 -0
- package/src/functional.ts +258 -243
- package/src/programmers/AssertProgrammer.ts +1 -1
- package/src/programmers/CheckerProgrammer.ts +1 -1
- package/src/programmers/FeatureProgrammer.ts +1 -1
- package/src/programmers/IsProgrammer.ts +1 -1
- package/src/programmers/RandomProgrammer.ts +1 -1
- package/src/programmers/ValidateProgrammer.ts +1 -1
- package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +103 -18
- package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +22 -45
- package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +44 -40
- package/src/programmers/helpers/FunctionImporeter.ts +1 -87
- package/src/programmers/helpers/FunctionImporter.ts +87 -0
- package/src/programmers/helpers/StringifyJoinder.ts +1 -1
- package/src/programmers/helpers/disable_function_importer_declare.ts +1 -1
- package/src/programmers/http/HttpFormDataProgrammer.ts +1 -1
- package/src/programmers/http/HttpHeadersProgrammer.ts +1 -1
- package/src/programmers/http/HttpParameterProgrammer.ts +1 -1
- package/src/programmers/http/HttpQueryProgrammer.ts +1 -1
- package/src/programmers/internal/check_dynamic_key.ts +1 -1
- package/src/programmers/internal/check_dynamic_properties.ts +1 -1
- package/src/programmers/internal/check_object.ts +1 -1
- package/src/programmers/internal/feature_object_entries.ts +1 -1
- package/src/programmers/json/JsonStringifyProgrammer.ts +1 -1
- package/src/programmers/misc/MiscCloneProgrammer.ts +1 -1
- package/src/programmers/misc/MiscPruneProgrammer.ts +1 -1
- package/src/programmers/notations/NotationGeneralProgrammer.ts +1 -1
- package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +1 -1
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +1 -1
- package/src/transformers/features/functional/FunctionalGenericTransformer.ts +10 -15
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionalAssert = void 0;
|
|
4
|
+
var TypeGuardError_1 = require("../../TypeGuardError");
|
|
5
|
+
var functionalAssert = function () { return ({
|
|
6
|
+
errorFactory: function (p) { return new TypeGuardError_1.TypeGuardError(p); },
|
|
7
|
+
}); };
|
|
8
|
+
exports.functionalAssert = functionalAssert;
|
|
9
|
+
//# sourceMappingURL=functional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functional.js","sourceRoot":"","sources":["../../../src/functional/Namespace/functional.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAE/C,IAAM,gBAAgB,GAAG,cAAM,OAAA,CAAC;IACrC,YAAY,EAAE,UAAC,CAAwB,IAAK,OAAA,IAAI,+BAAc,CAAC,CAAC,CAAC,EAArB,CAAqB;CAClE,CAAC,EAFoC,CAEpC,CAAC;AAFU,QAAA,gBAAgB,oBAE1B"}
|
|
@@ -2,6 +2,7 @@ import { RandomGenerator } from "../../utils/RandomGenerator";
|
|
|
2
2
|
import { IValidation } from "../../IValidation";
|
|
3
3
|
import { TypeGuardError } from "../../TypeGuardError";
|
|
4
4
|
import { is } from "../is";
|
|
5
|
+
export * as functional from "./functional";
|
|
5
6
|
export * as json from "./json";
|
|
6
7
|
export * as http from "./http";
|
|
7
8
|
export * as notations from "./notations";
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.random = exports.validate = exports.assert = exports.is = exports.protobuf = exports.misc = exports.notations = exports.http = exports.json = void 0;
|
|
37
|
+
exports.random = exports.validate = exports.assert = exports.is = exports.protobuf = exports.misc = exports.notations = exports.http = exports.json = exports.functional = void 0;
|
|
38
38
|
var RandomGenerator_1 = require("../../utils/RandomGenerator");
|
|
39
39
|
var _every_1 = require("../$every");
|
|
40
40
|
var _guard_1 = require("../$guard");
|
|
@@ -43,6 +43,7 @@ var _report_1 = require("../$report");
|
|
|
43
43
|
var TypeGuardError_1 = require("../../TypeGuardError");
|
|
44
44
|
var is_1 = require("../is");
|
|
45
45
|
Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.is; } });
|
|
46
|
+
exports.functional = __importStar(require("./functional"));
|
|
46
47
|
exports.json = __importStar(require("./json"));
|
|
47
48
|
exports.http = __importStar(require("./http"));
|
|
48
49
|
exports.notations = __importStar(require("./notations"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functional/Namespace/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8D;AAE9D,oCAAmC;AACnC,oCAAmC;AACnC,kCAAiC;AACjC,sCAAqC;AAErC,uDAAsD;AACtD,4BAA2B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functional/Namespace/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8D;AAE9D,oCAAmC;AACnC,oCAAmC;AACnC,kCAAiC;AACjC,sCAAqC;AAErC,uDAAsD;AACtD,4BAA2B;AASlB,mFATA,OAAE,OASA;AAPX,2DAA2C;AAC3C,+CAA+B;AAC/B,+CAA+B;AAC/B,yDAAyC;AACzC,+CAA+B;AAC/B,uDAAuC;AAIhC,IAAM,MAAM,GAAG,UAAC,MAAc,IAAK,OAAA,uBACrC,IAAA,OAAE,GAAE,KACP,IAAI,EAAE,aAAK,EACX,KAAK,EAAE,eAAM,EACb,KAAK,EAAE,IAAA,eAAM,EAAC,gBAAS,MAAM,CAAE,CAAC,EAChC,SAAS,EAAE,UACT,OAAgB,EAChB,aAAsB,EACtB,OAAoD;QAEpD,IAAI,OAAO,KAAK,KAAK,IAAI,aAAa,KAAK,IAAI;YAC7C,MAAM,IAAI,+BAAc,uBACnB,OAAO,EAAE,KACZ,MAAM,EAAE,gBAAS,MAAM,CAAE,IACzB,CAAC;QACL,OAAO,OAAO,CAAC;IACjB,CAAC,IACD,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,3 @@
|
|
|
1
|
-
import { IValidation } from "./IValidation";
|
|
2
1
|
import { TypeGuardError } from "./TypeGuardError";
|
|
3
2
|
/**
|
|
4
3
|
* Asserts a function.
|
|
@@ -32,7 +31,7 @@ import { TypeGuardError } from "./TypeGuardError";
|
|
|
32
31
|
*
|
|
33
32
|
* @author Jeongho Nam - https://github.com/samchon
|
|
34
33
|
*/
|
|
35
|
-
declare function assertFunction<T extends (...args:
|
|
34
|
+
declare function assertFunction<T extends (...args: any[]) => any>(func: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;
|
|
36
35
|
declare const assertFunctionPure: typeof assertFunction;
|
|
37
36
|
export { assertFunctionPure as assertFunction };
|
|
38
37
|
/**
|
|
@@ -63,7 +62,7 @@ export { assertFunctionPure as assertFunction };
|
|
|
63
62
|
*
|
|
64
63
|
* @author Jeongho Nam - https://github.com/samchon
|
|
65
64
|
*/
|
|
66
|
-
declare function assertParameters<T extends (...args:
|
|
65
|
+
declare function assertParameters<T extends (...args: any[]) => any>(func: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;
|
|
67
66
|
declare const assertParametersPure: typeof assertParameters;
|
|
68
67
|
export { assertParametersPure as assertParameters };
|
|
69
68
|
/**
|
|
@@ -94,7 +93,7 @@ export { assertParametersPure as assertParameters };
|
|
|
94
93
|
*
|
|
95
94
|
* @author Jeongho Nam - https://github.com/samchon
|
|
96
95
|
*/
|
|
97
|
-
declare function assertReturn<T extends (...args:
|
|
96
|
+
declare function assertReturn<T extends (...args: any[]) => any>(func: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;
|
|
98
97
|
declare const assertReturnPure: typeof assertReturn;
|
|
99
98
|
export { assertReturnPure as assertReturn };
|
|
100
99
|
/**
|
|
@@ -130,7 +129,7 @@ export { assertReturnPure as assertReturn };
|
|
|
130
129
|
*
|
|
131
130
|
* @author Jeongho Nam - https://github.com/samchon
|
|
132
131
|
*/
|
|
133
|
-
declare function assertEqualsFunction<T extends (...args:
|
|
132
|
+
declare function assertEqualsFunction<T extends (...args: any[]) => any>(func: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;
|
|
134
133
|
declare const assertEqualsFunctionPure: typeof assertEqualsFunction;
|
|
135
134
|
export { assertEqualsFunctionPure as assertEqualsFunction };
|
|
136
135
|
/**
|
|
@@ -162,7 +161,7 @@ export { assertEqualsFunctionPure as assertEqualsFunction };
|
|
|
162
161
|
*
|
|
163
162
|
* @author Jeongho Nam - https://github.com/samchon
|
|
164
163
|
*/
|
|
165
|
-
declare function assertEqualsParameters<T extends (...args:
|
|
164
|
+
declare function assertEqualsParameters<T extends (...args: any[]) => any>(func: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;
|
|
166
165
|
declare const assertEqualsParametersPure: typeof assertEqualsParameters;
|
|
167
166
|
export { assertEqualsParametersPure as assertEqualsParameters };
|
|
168
167
|
/**
|
|
@@ -193,161 +192,6 @@ export { assertEqualsParametersPure as assertEqualsParameters };
|
|
|
193
192
|
*
|
|
194
193
|
* @author Jeongho Nam - https://github.com/samchon
|
|
195
194
|
*/
|
|
196
|
-
declare function assertEqualsReturn<T extends (...args:
|
|
195
|
+
declare function assertEqualsReturn<T extends (...args: any[]) => any>(func: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;
|
|
197
196
|
declare const assertEqualsReturnPure: typeof assertEqualsReturn;
|
|
198
197
|
export { assertEqualsReturnPure as assertEqualsReturn };
|
|
199
|
-
/**
|
|
200
|
-
* Validates a function.
|
|
201
|
-
*
|
|
202
|
-
* Validates a function, by wrapping the function and checking its parameters and
|
|
203
|
-
* return value through {@link validate} function. If some parameter or return value
|
|
204
|
-
* does not match the expected type, it returns {@link IValidation.IError} typed
|
|
205
|
-
* object. Otherwise there's no type error, it returns {@link IValidation.ISuccess}
|
|
206
|
-
* typed object instead.
|
|
207
|
-
*
|
|
208
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
209
|
-
* individual {@link validate} function. If the {@link IValidation.IError} occurs from
|
|
210
|
-
* some parameter, the path would start from `$input.parameters[number]`. Otherwise
|
|
211
|
-
* the path would start from `$input.return`.
|
|
212
|
-
*
|
|
213
|
-
* - `$input.parameters[0].~`
|
|
214
|
-
* - `$input.return.~`
|
|
215
|
-
*
|
|
216
|
-
* By the way, if what you want is not finding every type errors, but just finding
|
|
217
|
-
* the 1st type error, then use {@link assertFunction} instead. Otherwise, what you
|
|
218
|
-
* want is just validating parameters or return value only, you can use
|
|
219
|
-
* {@link validateParameters} or {@link validateReturn} instead.
|
|
220
|
-
*
|
|
221
|
-
* On the other hand, if you don't want to allow any superfluous properties, utilize
|
|
222
|
-
* {@link validateEqualsFunction} or {@link assertEqualsFunction} instead.
|
|
223
|
-
*
|
|
224
|
-
* @template T Target function type
|
|
225
|
-
* @param func Target function to validate
|
|
226
|
-
* @returns The wrapper function with type validations
|
|
227
|
-
*
|
|
228
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
229
|
-
*/
|
|
230
|
-
declare function validateFunction<T extends (...args: unknown[]) => unknown>(func: T): T extends (...args: infer Arguments) => infer Output ? Output extends Promise<infer R> ? (...args: Arguments) => Promise<IValidation<R>> : (...args: Arguments) => IValidation<Output> : never;
|
|
231
|
-
declare const validateFunctionPure: typeof validateFunction;
|
|
232
|
-
export { validateFunctionPure as validateFunction };
|
|
233
|
-
/**
|
|
234
|
-
* Validates parameters.
|
|
235
|
-
*
|
|
236
|
-
* Validates a function, by wrapping the function and checking its parameters through
|
|
237
|
-
* {@link validate} function. If some parameter does not match the expected type, it
|
|
238
|
-
* returns {@link IValidation.IError} typed object. Otherwise there's no type error,
|
|
239
|
-
* it returns {@link IValidation.ISuccess} typed object instead.
|
|
240
|
-
*
|
|
241
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
242
|
-
* individual {@link validate} function. If the {@link IValidation.IError} occurs from
|
|
243
|
-
* some parameter, the path would start from `$input.parameters[number]`.
|
|
244
|
-
*
|
|
245
|
-
* By the way, if what you want is not finding every type errors, but just finding
|
|
246
|
-
* the 1st type error, then use {@link assertParameters} instead. Otherwise, what you
|
|
247
|
-
* want is not only validating parameters, but also validating return value, you can
|
|
248
|
-
* use {@link validateFunction} instead.
|
|
249
|
-
*
|
|
250
|
-
* On the other hand, if you don't want to allow any superfluous properties, utilize
|
|
251
|
-
* {@link validateEqualsParameters} or {@link assertEqualsParameters} instead.
|
|
252
|
-
*
|
|
253
|
-
* @template T Target function type
|
|
254
|
-
* @param func Target function to validate
|
|
255
|
-
* @returns The wrapper function with type validations
|
|
256
|
-
*
|
|
257
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
258
|
-
*/
|
|
259
|
-
declare function validateReturn<T extends (...args: unknown[]) => unknown>(func: T): T extends (...args: infer Arguments) => infer Output ? Output extends Promise<infer R> ? (...args: Arguments) => Promise<IValidation<R>> : (...args: Arguments) => IValidation<Output> : never;
|
|
260
|
-
declare const validateReturnPure: typeof validateReturn;
|
|
261
|
-
export { validateReturnPure as validateReturn };
|
|
262
|
-
/**
|
|
263
|
-
* Validates a function with strict equality.
|
|
264
|
-
*
|
|
265
|
-
* Validates a function with strict equality, by wrapping the function and checking
|
|
266
|
-
* its parameters and return value through {@link validateEquals} function. If some
|
|
267
|
-
* parameter or return value does not match the expected type, it returns
|
|
268
|
-
* {@link IValidation.IError} typed object. Otherwise there's no type error, it
|
|
269
|
-
* returns {@link IValidation.ISuccess} typed object instead.
|
|
270
|
-
*
|
|
271
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
272
|
-
* individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
|
|
273
|
-
* from some parameter, the path would start from `$input.parameters[number]`. Otherwise
|
|
274
|
-
* the path would start from `$input.return`.
|
|
275
|
-
*
|
|
276
|
-
* - `$input.parameters[0].~`
|
|
277
|
-
* - `$input.return.~`
|
|
278
|
-
*
|
|
279
|
-
* By the way, if what you want is not finding every type errors, but just finding
|
|
280
|
-
* the 1st type error, then use {@link assertEqualsFunction} instead. Otherwise, what
|
|
281
|
-
* you want is just validating parameters or return value only, you can use
|
|
282
|
-
* {@link validateEqualsParameters} or {@link validateEqualsReturn} instead.
|
|
283
|
-
*
|
|
284
|
-
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
285
|
-
* {@link validateFunction} or {@link assertFunction} instead.
|
|
286
|
-
*
|
|
287
|
-
* @template T Target function type
|
|
288
|
-
* @param func Target function to validate
|
|
289
|
-
* @returns The wrapper function with type validations
|
|
290
|
-
*
|
|
291
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
292
|
-
*/
|
|
293
|
-
declare function validateEqualsFunction<T extends (...args: unknown[]) => unknown>(func: T): T extends (...args: infer Arguments) => infer Output ? Output extends Promise<infer R> ? (...args: Arguments) => Promise<IValidation<R>> : (...args: Arguments) => IValidation<Output> : never;
|
|
294
|
-
declare const validateEqualsFunctionPure: typeof validateEqualsFunction;
|
|
295
|
-
export { validateEqualsFunctionPure as validateEqualsFunction };
|
|
296
|
-
/**
|
|
297
|
-
* Validates parameters with strict equality.
|
|
298
|
-
*
|
|
299
|
-
* Validates a function, by wrapping the function and checking its parameters through
|
|
300
|
-
* {@link validateEquals} function. If some parameter does not match the expected type,
|
|
301
|
-
* it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
|
|
302
|
-
* it returns {@link IValidation.ISuccess} typed object instead.
|
|
303
|
-
*
|
|
304
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
305
|
-
* individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
|
|
306
|
-
* from some parameter, the path would start from `$input.parameters[number]`.
|
|
307
|
-
*
|
|
308
|
-
* By the way, if what you want is not finding every type errors, but just finding
|
|
309
|
-
* the 1st type error, then use {@link assertEqualsParameters} instead. Otherwise,
|
|
310
|
-
* what you want is not only validating parameters, but also validating return value,
|
|
311
|
-
* you can use {@link validateEqualsFunction} instead.
|
|
312
|
-
*
|
|
313
|
-
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
314
|
-
* {@link validateParameters} or {@link assertParameters} instead.
|
|
315
|
-
*
|
|
316
|
-
* @template T Target function type
|
|
317
|
-
* @param func Target function to validate
|
|
318
|
-
* @returns The wrapper function with type validations
|
|
319
|
-
*
|
|
320
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
321
|
-
*/
|
|
322
|
-
declare function validateEqualsParameters<T extends (...args: unknown[]) => unknown>(func: T): T extends (...args: infer Arguments) => infer Output ? Output extends Promise<infer R> ? (...args: Arguments) => Promise<IValidation<R>> : (...args: Arguments) => IValidation<Output> : never;
|
|
323
|
-
declare const validateEqualsParametersPure: typeof validateEqualsParameters;
|
|
324
|
-
export { validateEqualsParametersPure as validateEqualsParameters };
|
|
325
|
-
/**
|
|
326
|
-
* Validates return value with strict equality.
|
|
327
|
-
*
|
|
328
|
-
* Validates a function, by wrapping the function and checking its return value through
|
|
329
|
-
* {@link validateEquals} function. If the return value does not match the expected type,
|
|
330
|
-
* it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
|
|
331
|
-
* it returns {@link IValidation.ISuccess} typed object instead.
|
|
332
|
-
*
|
|
333
|
-
* For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
334
|
-
* individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
|
|
335
|
-
* from the return value, the path would start from `$input.return`.
|
|
336
|
-
*
|
|
337
|
-
* By the way, if what you want is not finding every type errors, but just finding
|
|
338
|
-
* the 1st type error, then use {@link assertEqualsReturn} instead. Otherwise, what you
|
|
339
|
-
* want is not only validating return value, but also validating parameters, you can use
|
|
340
|
-
* {@link validateEqualsFunction} instead.
|
|
341
|
-
*
|
|
342
|
-
* On the other hand, if you want to allow any superfluous properties, utilize
|
|
343
|
-
* {@link validateReturn} or {@link assertReturn} instead.
|
|
344
|
-
*
|
|
345
|
-
* @template T Target function type
|
|
346
|
-
* @param func Target function to validate
|
|
347
|
-
* @returns The wrapper function with type validations
|
|
348
|
-
*
|
|
349
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
350
|
-
*/
|
|
351
|
-
declare function validateEqualsReturn<T extends (...args: unknown[]) => unknown>(func: T): T extends (...args: infer Arguments) => infer Output ? Output extends Promise<infer R> ? (...args: Arguments) => Promise<IValidation<R>> : (...args: Arguments) => IValidation<Output> : never;
|
|
352
|
-
declare const validateEqualsReturnPure: typeof validateEqualsReturn;
|
|
353
|
-
export { validateEqualsReturnPure as validateEqualsReturn };
|
package/lib/functional.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.assertEqualsReturn = exports.assertEqualsParameters = exports.assertEqualsFunction = exports.assertReturn = exports.assertParameters = exports.assertFunction = void 0;
|
|
27
27
|
var Namespace = __importStar(require("./functional/Namespace"));
|
|
28
28
|
/**
|
|
29
29
|
* @internal
|
|
@@ -32,7 +32,8 @@ function assertFunction() {
|
|
|
32
32
|
halt("assertFunction");
|
|
33
33
|
}
|
|
34
34
|
var assertFunctionPure = /** @__PURE__ */ Object.assign(assertFunction,
|
|
35
|
-
/** @__PURE__ */ Namespace.assert("functional.assertFunction")
|
|
35
|
+
/** @__PURE__ */ Namespace.assert("functional.assertFunction"),
|
|
36
|
+
/** @__PURE__ */ Namespace.functional.functionalAssert());
|
|
36
37
|
exports.assertFunction = assertFunctionPure;
|
|
37
38
|
/**
|
|
38
39
|
* @internal
|
|
@@ -40,8 +41,9 @@ exports.assertFunction = assertFunctionPure;
|
|
|
40
41
|
function assertParameters() {
|
|
41
42
|
halt("assertParameters");
|
|
42
43
|
}
|
|
43
|
-
var assertParametersPure = /** @__PURE__ */ Object.assign(
|
|
44
|
-
/** @__PURE__ */ Namespace.assert("functional.
|
|
44
|
+
var assertParametersPure = /** @__PURE__ */ Object.assign(assertFunction,
|
|
45
|
+
/** @__PURE__ */ Namespace.assert("functional.assertFunction"),
|
|
46
|
+
/** @__PURE__ */ Namespace.functional.functionalAssert());
|
|
45
47
|
exports.assertParameters = assertParametersPure;
|
|
46
48
|
/**
|
|
47
49
|
* @internal
|
|
@@ -49,7 +51,9 @@ exports.assertParameters = assertParametersPure;
|
|
|
49
51
|
function assertReturn() {
|
|
50
52
|
halt("assertReturn");
|
|
51
53
|
}
|
|
52
|
-
var assertReturnPure = /** @__PURE__ */ Object.assign(assertReturn,
|
|
54
|
+
var assertReturnPure = /** @__PURE__ */ Object.assign(assertReturn,
|
|
55
|
+
/** @__PURE__ */ Namespace.assert("functional.assertReturn"),
|
|
56
|
+
/** @__PURE__ */ Namespace.functional.functionalAssert());
|
|
53
57
|
exports.assertReturn = assertReturnPure;
|
|
54
58
|
/**
|
|
55
59
|
* @internal
|
|
@@ -58,7 +62,8 @@ function assertEqualsFunction() {
|
|
|
58
62
|
halt("assertEqualsFunction");
|
|
59
63
|
}
|
|
60
64
|
var assertEqualsFunctionPure = /** @__PURE__ */ Object.assign(assertEqualsFunction,
|
|
61
|
-
/** @__PURE__ */ Namespace.assert("functional.assertEqualsFunction")
|
|
65
|
+
/** @__PURE__ */ Namespace.assert("functional.assertEqualsFunction"),
|
|
66
|
+
/** @__PURE__ */ Namespace.functional.functionalAssert());
|
|
62
67
|
exports.assertEqualsFunction = assertEqualsFunctionPure;
|
|
63
68
|
/**
|
|
64
69
|
* @internal
|
|
@@ -67,7 +72,8 @@ function assertEqualsParameters() {
|
|
|
67
72
|
halt("assertEqualsParameters");
|
|
68
73
|
}
|
|
69
74
|
var assertEqualsParametersPure = /** @__PURE__ */ Object.assign(assertEqualsParameters,
|
|
70
|
-
/** @__PURE__ */ Namespace.assert("functional.assertEqualsParameters")
|
|
75
|
+
/** @__PURE__ */ Namespace.assert("functional.assertEqualsParameters"),
|
|
76
|
+
/** @__PURE__ */ Namespace.functional.functionalAssert());
|
|
71
77
|
exports.assertEqualsParameters = assertEqualsParametersPure;
|
|
72
78
|
/**
|
|
73
79
|
* @internal
|
|
@@ -76,48 +82,242 @@ function assertEqualsReturn() {
|
|
|
76
82
|
halt("assertEqualsReturn");
|
|
77
83
|
}
|
|
78
84
|
var assertEqualsReturnPure = /** @__PURE__ */ Object.assign(assertEqualsReturn,
|
|
79
|
-
/** @__PURE__ */ Namespace.assert("functional.assertEqualsReturn")
|
|
85
|
+
/** @__PURE__ */ Namespace.assert("functional.assertEqualsReturn"),
|
|
86
|
+
/** @__PURE__ */ Namespace.functional.functionalAssert());
|
|
80
87
|
exports.assertEqualsReturn = assertEqualsReturnPure;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
88
|
+
// /* -----------------------------------------------------------
|
|
89
|
+
// VALIDATIONS
|
|
90
|
+
// ----------------------------------------------------------- */
|
|
91
|
+
// /**
|
|
92
|
+
// * Validates a function.
|
|
93
|
+
// *
|
|
94
|
+
// * Validates a function, by wrapping the function and checking its parameters and
|
|
95
|
+
// * return value through {@link validate} function. If some parameter or return value
|
|
96
|
+
// * does not match the expected type, it returns {@link IValidation.IError} typed
|
|
97
|
+
// * object. Otherwise there's no type error, it returns {@link IValidation.ISuccess}
|
|
98
|
+
// * typed object instead.
|
|
99
|
+
// *
|
|
100
|
+
// * For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
101
|
+
// * individual {@link validate} function. If the {@link IValidation.IError} occurs from
|
|
102
|
+
// * some parameter, the path would start from `$input.parameters[number]`. Otherwise
|
|
103
|
+
// * the path would start from `$input.return`.
|
|
104
|
+
// *
|
|
105
|
+
// * - `$input.parameters[0].~`
|
|
106
|
+
// * - `$input.return.~`
|
|
107
|
+
// *
|
|
108
|
+
// * By the way, if what you want is not finding every type errors, but just finding
|
|
109
|
+
// * the 1st type error, then use {@link assertFunction} instead. Otherwise, what you
|
|
110
|
+
// * want is just validating parameters or return value only, you can use
|
|
111
|
+
// * {@link validateParameters} or {@link validateReturn} instead.
|
|
112
|
+
// *
|
|
113
|
+
// * On the other hand, if you don't want to allow any superfluous properties, utilize
|
|
114
|
+
// * {@link validateEqualsFunction} or {@link assertEqualsFunction} instead.
|
|
115
|
+
// *
|
|
116
|
+
// * @template T Target function type
|
|
117
|
+
// * @param func Target function to validate
|
|
118
|
+
// * @returns The wrapper function with type validations
|
|
119
|
+
// *
|
|
120
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
121
|
+
// */
|
|
122
|
+
// function validateFunction<T extends (...args: any[]) => any>(
|
|
123
|
+
// func: T,
|
|
124
|
+
// ): T extends (...args: infer Arguments) => infer Output
|
|
125
|
+
// ? Output extends Promise<infer R>
|
|
126
|
+
// ? (...args: Arguments) => Promise<IValidation<R>>
|
|
127
|
+
// : (...args: Arguments) => IValidation<Output>
|
|
128
|
+
// : never;
|
|
129
|
+
// /**
|
|
130
|
+
// * @internal
|
|
131
|
+
// */
|
|
132
|
+
// function validateFunction(): never {
|
|
133
|
+
// halt("validateFunction");
|
|
134
|
+
// }
|
|
135
|
+
// const validateFunctionPure = /** @__PURE__ */ Object.assign<
|
|
136
|
+
// typeof validateFunction,
|
|
137
|
+
// {}
|
|
138
|
+
// >(validateFunction, /** @__PURE__ */ Namespace.validate());
|
|
139
|
+
// export { validateFunctionPure as validateFunction };
|
|
140
|
+
// /**
|
|
141
|
+
// * Validates parameters.
|
|
142
|
+
// *
|
|
143
|
+
// * Validates a function, by wrapping the function and checking its parameters through
|
|
144
|
+
// * {@link validate} function. If some parameter does not match the expected type, it
|
|
145
|
+
// * returns {@link IValidation.IError} typed object. Otherwise there's no type error,
|
|
146
|
+
// * it returns {@link IValidation.ISuccess} typed object instead.
|
|
147
|
+
// *
|
|
148
|
+
// * For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
149
|
+
// * individual {@link validate} function. If the {@link IValidation.IError} occurs from
|
|
150
|
+
// * some parameter, the path would start from `$input.parameters[number]`.
|
|
151
|
+
// *
|
|
152
|
+
// * By the way, if what you want is not finding every type errors, but just finding
|
|
153
|
+
// * the 1st type error, then use {@link assertParameters} instead. Otherwise, what you
|
|
154
|
+
// * want is not only validating parameters, but also validating return value, you can
|
|
155
|
+
// * use {@link validateFunction} instead.
|
|
156
|
+
// *
|
|
157
|
+
// * On the other hand, if you don't want to allow any superfluous properties, utilize
|
|
158
|
+
// * {@link validateEqualsParameters} or {@link assertEqualsParameters} instead.
|
|
159
|
+
// *
|
|
160
|
+
// * @template T Target function type
|
|
161
|
+
// * @param func Target function to validate
|
|
162
|
+
// * @returns The wrapper function with type validations
|
|
163
|
+
// *
|
|
164
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
165
|
+
// */
|
|
166
|
+
// function validateReturn<T extends (...args: any[]) => any>(
|
|
167
|
+
// func: T,
|
|
168
|
+
// ): T extends (...args: infer Arguments) => infer Output
|
|
169
|
+
// ? Output extends Promise<infer R>
|
|
170
|
+
// ? (...args: Arguments) => Promise<IValidation<R>>
|
|
171
|
+
// : (...args: Arguments) => IValidation<Output>
|
|
172
|
+
// : never;
|
|
173
|
+
// /**
|
|
174
|
+
// * @internal
|
|
175
|
+
// */
|
|
176
|
+
// function validateReturn(): never {
|
|
177
|
+
// halt("validateReturn");
|
|
178
|
+
// }
|
|
179
|
+
// const validateReturnPure = /** @__PURE__ */ Object.assign<
|
|
180
|
+
// typeof validateReturn,
|
|
181
|
+
// {}
|
|
182
|
+
// >(validateReturn, /** @__PURE__ */ Namespace.validate());
|
|
183
|
+
// export { validateReturnPure as validateReturn };
|
|
184
|
+
// /**
|
|
185
|
+
// * Validates a function with strict equality.
|
|
186
|
+
// *
|
|
187
|
+
// * Validates a function with strict equality, by wrapping the function and checking
|
|
188
|
+
// * its parameters and return value through {@link validateEquals} function. If some
|
|
189
|
+
// * parameter or return value does not match the expected type, it returns
|
|
190
|
+
// * {@link IValidation.IError} typed object. Otherwise there's no type error, it
|
|
191
|
+
// * returns {@link IValidation.ISuccess} typed object instead.
|
|
192
|
+
// *
|
|
193
|
+
// * For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
194
|
+
// * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
|
|
195
|
+
// * from some parameter, the path would start from `$input.parameters[number]`. Otherwise
|
|
196
|
+
// * the path would start from `$input.return`.
|
|
197
|
+
// *
|
|
198
|
+
// * - `$input.parameters[0].~`
|
|
199
|
+
// * - `$input.return.~`
|
|
200
|
+
// *
|
|
201
|
+
// * By the way, if what you want is not finding every type errors, but just finding
|
|
202
|
+
// * the 1st type error, then use {@link assertEqualsFunction} instead. Otherwise, what
|
|
203
|
+
// * you want is just validating parameters or return value only, you can use
|
|
204
|
+
// * {@link validateEqualsParameters} or {@link validateEqualsReturn} instead.
|
|
205
|
+
// *
|
|
206
|
+
// * On the other hand, if you want to allow any superfluous properties, utilize
|
|
207
|
+
// * {@link validateFunction} or {@link assertFunction} instead.
|
|
208
|
+
// *
|
|
209
|
+
// * @template T Target function type
|
|
210
|
+
// * @param func Target function to validate
|
|
211
|
+
// * @returns The wrapper function with type validations
|
|
212
|
+
// *
|
|
213
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
214
|
+
// */
|
|
215
|
+
// function validateEqualsFunction<T extends (...args: any[]) => any>(
|
|
216
|
+
// func: T,
|
|
217
|
+
// ): T extends (...args: infer Arguments) => infer Output
|
|
218
|
+
// ? Output extends Promise<infer R>
|
|
219
|
+
// ? (...args: Arguments) => Promise<IValidation<R>>
|
|
220
|
+
// : (...args: Arguments) => IValidation<Output>
|
|
221
|
+
// : never;
|
|
222
|
+
// /**
|
|
223
|
+
// * @internal
|
|
224
|
+
// */
|
|
225
|
+
// function validateEqualsFunction(): never {
|
|
226
|
+
// halt("validateEqualsFunction");
|
|
227
|
+
// }
|
|
228
|
+
// const validateEqualsFunctionPure = /** @__PURE__ */ Object.assign<
|
|
229
|
+
// typeof validateEqualsFunction,
|
|
230
|
+
// {}
|
|
231
|
+
// >(validateEqualsFunction, /** @__PURE__ */ Namespace.validate());
|
|
232
|
+
// export { validateEqualsFunctionPure as validateEqualsFunction };
|
|
233
|
+
// /**
|
|
234
|
+
// * Validates parameters with strict equality.
|
|
235
|
+
// *
|
|
236
|
+
// * Validates a function, by wrapping the function and checking its parameters through
|
|
237
|
+
// * {@link validateEquals} function. If some parameter does not match the expected type,
|
|
238
|
+
// * it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
|
|
239
|
+
// * it returns {@link IValidation.ISuccess} typed object instead.
|
|
240
|
+
// *
|
|
241
|
+
// * For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
242
|
+
// * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
|
|
243
|
+
// * from some parameter, the path would start from `$input.parameters[number]`.
|
|
244
|
+
// *
|
|
245
|
+
// * By the way, if what you want is not finding every type errors, but just finding
|
|
246
|
+
// * the 1st type error, then use {@link assertEqualsParameters} instead. Otherwise,
|
|
247
|
+
// * what you want is not only validating parameters, but also validating return value,
|
|
248
|
+
// * you can use {@link validateEqualsFunction} instead.
|
|
249
|
+
// *
|
|
250
|
+
// * On the other hand, if you want to allow any superfluous properties, utilize
|
|
251
|
+
// * {@link validateParameters} or {@link assertParameters} instead.
|
|
252
|
+
// *
|
|
253
|
+
// * @template T Target function type
|
|
254
|
+
// * @param func Target function to validate
|
|
255
|
+
// * @returns The wrapper function with type validations
|
|
256
|
+
// *
|
|
257
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
258
|
+
// */
|
|
259
|
+
// function validateEqualsParameters<T extends (...args: any[]) => any>(
|
|
260
|
+
// func: T,
|
|
261
|
+
// ): T extends (...args: infer Arguments) => infer Output
|
|
262
|
+
// ? Output extends Promise<infer R>
|
|
263
|
+
// ? (...args: Arguments) => Promise<IValidation<R>>
|
|
264
|
+
// : (...args: Arguments) => IValidation<Output>
|
|
265
|
+
// : never;
|
|
266
|
+
// /**
|
|
267
|
+
// * @internal
|
|
268
|
+
// */
|
|
269
|
+
// function validateEqualsParameters(): never {
|
|
270
|
+
// halt("validateEqualsParameters");
|
|
271
|
+
// }
|
|
272
|
+
// const validateEqualsParametersPure = /** @__PURE__ */ Object.assign<
|
|
273
|
+
// typeof validateEqualsParameters,
|
|
274
|
+
// {}
|
|
275
|
+
// >(validateEqualsParameters, /** @__PURE__ */ Namespace.validate());
|
|
276
|
+
// export { validateEqualsParametersPure as validateEqualsParameters };
|
|
277
|
+
// /**
|
|
278
|
+
// * Validates return value with strict equality.
|
|
279
|
+
// *
|
|
280
|
+
// * Validates a function, by wrapping the function and checking its return value through
|
|
281
|
+
// * {@link validateEquals} function. If the return value does not match the expected type,
|
|
282
|
+
// * it returns {@link IValidation.IError} typed object. Otherwise there's no type error,
|
|
283
|
+
// * it returns {@link IValidation.ISuccess} typed object instead.
|
|
284
|
+
// *
|
|
285
|
+
// * For reference, {@link IValidation.IError.path} would be a little bit different with
|
|
286
|
+
// * individual {@link validateEquals} function. If the {@link IValidation.IError} occurs
|
|
287
|
+
// * from the return value, the path would start from `$input.return`.
|
|
288
|
+
// *
|
|
289
|
+
// * By the way, if what you want is not finding every type errors, but just finding
|
|
290
|
+
// * the 1st type error, then use {@link assertEqualsReturn} instead. Otherwise, what you
|
|
291
|
+
// * want is not only validating return value, but also validating parameters, you can use
|
|
292
|
+
// * {@link validateEqualsFunction} instead.
|
|
293
|
+
// *
|
|
294
|
+
// * On the other hand, if you want to allow any superfluous properties, utilize
|
|
295
|
+
// * {@link validateReturn} or {@link assertReturn} instead.
|
|
296
|
+
// *
|
|
297
|
+
// * @template T Target function type
|
|
298
|
+
// * @param func Target function to validate
|
|
299
|
+
// * @returns The wrapper function with type validations
|
|
300
|
+
// *
|
|
301
|
+
// * @author Jeongho Nam - https://github.com/samchon
|
|
302
|
+
// */
|
|
303
|
+
// function validateEqualsReturn<T extends (...args: any[]) => any>(
|
|
304
|
+
// func: T,
|
|
305
|
+
// ): T extends (...args: infer Arguments) => infer Output
|
|
306
|
+
// ? Output extends Promise<infer R>
|
|
307
|
+
// ? (...args: Arguments) => Promise<IValidation<R>>
|
|
308
|
+
// : (...args: Arguments) => IValidation<Output>
|
|
309
|
+
// : never;
|
|
310
|
+
// /**
|
|
311
|
+
// * @internal
|
|
312
|
+
// */
|
|
313
|
+
// function validateEqualsReturn(): never {
|
|
314
|
+
// halt("validateEqualsReturn");
|
|
315
|
+
// }
|
|
316
|
+
// const validateEqualsReturnPure = /** @__PURE__ */ Object.assign<
|
|
317
|
+
// typeof validateEqualsReturn,
|
|
318
|
+
// {}
|
|
319
|
+
// >(validateEqualsReturn, /** @__PURE__ */ Namespace.validate());
|
|
320
|
+
// export { validateEqualsReturnPure as validateEqualsReturn };
|
|
121
321
|
/* -----------------------------------------------------------
|
|
122
322
|
HALTER
|
|
123
323
|
----------------------------------------------------------- */
|
package/lib/functional.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functional.js","sourceRoot":"","sources":["../src/functional.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAoD;AAiDpD;;GAEG;AACH,SAAS,cAAc;IACrB,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACzB,CAAC;AACD,IAAM,kBAAkB,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"functional.js","sourceRoot":"","sources":["../src/functional.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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