typia 5.2.2 → 5.2.3
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/Primitive.d.ts +1 -1
- package/lib/executable/setup/CommandExecutor.js +2 -2
- package/lib/executable/setup/CommandExecutor.js.map +1 -1
- package/package.json +1 -2
- package/src/CamelCase.ts +116 -116
- package/src/PascalCase.ts +116 -116
- package/src/Primitive.ts +135 -135
- package/src/Resolved.ts +116 -116
- package/src/SnakeCase.ts +156 -156
- package/src/executable/TypiaSetupWizard.ts +142 -142
- package/src/executable/setup/CommandExecutor.ts +2 -2
- package/src/factories/JsonMetadataFactory.ts +50 -50
- package/src/factories/MetadataCollection.ts +282 -282
- package/src/functional/$convention.ts +40 -40
- package/src/functional/Namespace.ts +164 -164
- package/src/module.ts +662 -662
- package/src/notations.ts +855 -855
- package/src/programmers/helpers/AtomicPredicator.ts +31 -31
- package/src/programmers/helpers/NotationJoiner.ts +146 -146
- package/src/programmers/misc/MiscCloneProgrammer.ts +790 -790
- package/src/programmers/misc/MiscPruneProgrammer.ts +552 -552
- package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +72 -72
- package/src/programmers/notations/NotationGeneralProgrammer.ts +720 -720
- package/src/programmers/notations/NotationIsGeneralProgrammer.ts +79 -79
- package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +88 -88
- package/src/transformers/CallExpressionTransformer.ts +380 -380
- package/src/transformers/features/json/JsonAssertParseTransformer.ts +10 -10
- package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
- package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +12 -12
- package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
- package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +12 -12
- package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +12 -12
- package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
- package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
- package/src/transformers/features/json/JsonIsStringifyTransformer.ts +10 -10
- package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
- package/src/transformers/features/json/JsonValidateParseTransformer.ts +10 -10
- package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
- package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +10 -10
- package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +10 -10
- package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +12 -12
- package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +12 -12
- package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +12 -12
- package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +12 -12
- package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
- package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +10 -10
- package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +10 -10
- package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +17 -17
- package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
- package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
- package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +17 -17
- package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
- package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
- package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
- package/src/utils/NamingConvention.ts +91 -91
- package/src/utils/StringUtil.ts +4 -4
package/src/notations.ts
CHANGED
|
@@ -1,855 +1,855 @@
|
|
|
1
|
-
import { Namespace } from "./functional/Namespace";
|
|
2
|
-
|
|
3
|
-
import { CamelCase } from "./CamelCase";
|
|
4
|
-
import { IValidation } from "./IValidation";
|
|
5
|
-
import { PascalCase } from "./PascalCase";
|
|
6
|
-
import { SnakeCase } from "./SnakeCase";
|
|
7
|
-
|
|
8
|
-
/* ===========================================================
|
|
9
|
-
NOTATIONS (NAMING CONVENTIONS)
|
|
10
|
-
- CAMEL CASE
|
|
11
|
-
- PASCAL CASE
|
|
12
|
-
- SNAKE CASE
|
|
13
|
-
- FACTORY FUNCTIONS
|
|
14
|
-
==============================================================
|
|
15
|
-
CAMEL CASE
|
|
16
|
-
----------------------------------------------------------- */
|
|
17
|
-
/**
|
|
18
|
-
* Convert to camel case.
|
|
19
|
-
*
|
|
20
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
21
|
-
*
|
|
22
|
-
* For reference, this `typia.notations.camel()` function does not validate the input value
|
|
23
|
-
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
24
|
-
* if you can't ensure the input value type, it would be better to call one of them below:
|
|
25
|
-
*
|
|
26
|
-
* - {@link assertCamel}
|
|
27
|
-
* - {@link isCamel}
|
|
28
|
-
* - {@link validateCamel}
|
|
29
|
-
*
|
|
30
|
-
* @template T Type of the input value
|
|
31
|
-
* @param input Target object
|
|
32
|
-
* @returns Camel case object
|
|
33
|
-
*
|
|
34
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
35
|
-
*/
|
|
36
|
-
export function camel<T>(input: T): CamelCase<T>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
export function camel(): never {
|
|
42
|
-
return halt("camel");
|
|
43
|
-
}
|
|
44
|
-
Object.assign(camel, Namespace.notations.camel("camel"));
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Converts to camel case with type assertion.
|
|
48
|
-
*
|
|
49
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
50
|
-
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
51
|
-
*
|
|
52
|
-
* @template T Type of the input value
|
|
53
|
-
* @param input Target object
|
|
54
|
-
* @returns Camel case object
|
|
55
|
-
*
|
|
56
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
57
|
-
*/
|
|
58
|
-
export function assertCamel<T>(input: T): CamelCase<T>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Converts to camel case with type assertion.
|
|
62
|
-
*
|
|
63
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
64
|
-
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
65
|
-
*
|
|
66
|
-
* @template T Type of the input value
|
|
67
|
-
* @param input Target object
|
|
68
|
-
* @returns Camel case object
|
|
69
|
-
*
|
|
70
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
71
|
-
*/
|
|
72
|
-
export function assertCamel<T>(input: unknown): CamelCase<T>;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
export function assertCamel(): never {
|
|
78
|
-
return halt("assertCamel");
|
|
79
|
-
}
|
|
80
|
-
Object.assign(assertCamel, Namespace.notations.camel("assertCamel"));
|
|
81
|
-
Object.assign(assertCamel, Namespace.assert("notations.assertCamel"));
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Converts to camel case with type checking.
|
|
85
|
-
*
|
|
86
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
87
|
-
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
88
|
-
*
|
|
89
|
-
* @template T Type of the input value
|
|
90
|
-
* @param input Target object
|
|
91
|
-
* @returns Camel case object when exact type, otherwise null
|
|
92
|
-
*
|
|
93
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
94
|
-
*/
|
|
95
|
-
export function isCamel<T>(input: T): CamelCase<T> | null;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Converts to camel case with type checking.
|
|
99
|
-
*
|
|
100
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
101
|
-
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
102
|
-
*
|
|
103
|
-
* @template T Type of the input value
|
|
104
|
-
* @param input Target object
|
|
105
|
-
* @returns Camel case object when exact type, otherwise null
|
|
106
|
-
*
|
|
107
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
108
|
-
*/
|
|
109
|
-
export function isCamel<T>(input: unknown): CamelCase<T> | null;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @internal
|
|
113
|
-
*/
|
|
114
|
-
export function isCamel(): never {
|
|
115
|
-
return halt("isCamel");
|
|
116
|
-
}
|
|
117
|
-
Object.assign(isCamel, Namespace.notations.camel("isCamel"));
|
|
118
|
-
Object.assign(isCamel, Namespace.is());
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Converts to camel case with type validation.
|
|
122
|
-
*
|
|
123
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
124
|
-
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
125
|
-
* object. Otherwise, there's no problem on the input value, camel cased converted data
|
|
126
|
-
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
127
|
-
*
|
|
128
|
-
* @template T Type of the input value
|
|
129
|
-
* @param input Target object
|
|
130
|
-
* @returns Validation result with camel case object
|
|
131
|
-
*
|
|
132
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
133
|
-
*/
|
|
134
|
-
export function validateCamel<T>(input: T): IValidation<CamelCase<T>>;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Converts to camel case with type validation.
|
|
138
|
-
*
|
|
139
|
-
* Convert every property names of nested objects to follow the camel case convention.
|
|
140
|
-
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
141
|
-
* object. Otherwise, there's no problem on the input value, camel cased converted data
|
|
142
|
-
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
143
|
-
*
|
|
144
|
-
* @template T Type of the input value
|
|
145
|
-
* @param input Target object
|
|
146
|
-
* @returns Validation result with camel case object
|
|
147
|
-
*
|
|
148
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
149
|
-
*/
|
|
150
|
-
export function validateCamel<T>(input: unknown): IValidation<CamelCase<T>>;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @internal
|
|
154
|
-
*/
|
|
155
|
-
export function validateCamel(): never {
|
|
156
|
-
return halt("validateCamel");
|
|
157
|
-
}
|
|
158
|
-
Object.assign(validateCamel, Namespace.notations.camel("validateCamel"));
|
|
159
|
-
Object.assign(validateCamel, Namespace.validate());
|
|
160
|
-
|
|
161
|
-
/* -----------------------------------------------------------
|
|
162
|
-
PASCAL CASE
|
|
163
|
-
----------------------------------------------------------- */
|
|
164
|
-
/**
|
|
165
|
-
* Convert to pascal case.
|
|
166
|
-
*
|
|
167
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
168
|
-
*
|
|
169
|
-
* For reference, this `typia.notations.pascal()` function does not validate the input value
|
|
170
|
-
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
171
|
-
* if you can't ensure the input value type, it would be better to call one of them below:
|
|
172
|
-
*
|
|
173
|
-
* - {@link assertPascal}
|
|
174
|
-
* - {@link isPascal}
|
|
175
|
-
* - {@link validatePascal}
|
|
176
|
-
*
|
|
177
|
-
* @template T Type of the input value
|
|
178
|
-
* @param input Target object
|
|
179
|
-
* @returns Pascal case object
|
|
180
|
-
*
|
|
181
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
182
|
-
*/
|
|
183
|
-
export function pascal<T>(input: T): PascalCase<T>;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @internal
|
|
187
|
-
*/
|
|
188
|
-
export function pascal(): never {
|
|
189
|
-
return halt("pascal");
|
|
190
|
-
}
|
|
191
|
-
Object.assign(pascal, Namespace.notations.pascal("pascal"));
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Converts to pascal case with type assertion.
|
|
195
|
-
*
|
|
196
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
197
|
-
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
198
|
-
*
|
|
199
|
-
* @template T Type of the input value
|
|
200
|
-
* @param input Target object
|
|
201
|
-
* @returns Pascal case object
|
|
202
|
-
*
|
|
203
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
204
|
-
*/
|
|
205
|
-
export function assertPascal<T>(input: T): PascalCase<T>;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Converts to pascal case with type assertion.
|
|
209
|
-
*
|
|
210
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
211
|
-
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
212
|
-
*
|
|
213
|
-
* @template T Type of the input value
|
|
214
|
-
* @param input Target object
|
|
215
|
-
* @returns Pascal case object
|
|
216
|
-
*
|
|
217
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
218
|
-
*/
|
|
219
|
-
export function assertPascal<T>(input: unknown): PascalCase<T>;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* @internal
|
|
223
|
-
*/
|
|
224
|
-
export function assertPascal(): never {
|
|
225
|
-
return halt("assertPascal");
|
|
226
|
-
}
|
|
227
|
-
Object.assign(assertPascal, Namespace.notations.pascal("assertPascal"));
|
|
228
|
-
Object.assign(assertPascal, Namespace.assert("notations.assertPascal"));
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Converts to pascal case with type checking.
|
|
232
|
-
*
|
|
233
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
234
|
-
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
235
|
-
*
|
|
236
|
-
* @template T Type of the input value
|
|
237
|
-
* @param input Target object
|
|
238
|
-
* @returns Pascal case object when exact type, otherwise null
|
|
239
|
-
*
|
|
240
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
241
|
-
*/
|
|
242
|
-
export function isPascal<T>(input: T): PascalCase<T> | null;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Converts to pascal case with type checking.
|
|
246
|
-
*
|
|
247
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
248
|
-
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
249
|
-
*
|
|
250
|
-
* @template T Type of the input value
|
|
251
|
-
* @param input Target object
|
|
252
|
-
* @returns Pascal case object when exact type, otherwise null
|
|
253
|
-
*
|
|
254
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
255
|
-
*/
|
|
256
|
-
export function isPascal<T>(input: unknown): PascalCase<T> | null;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @internal
|
|
260
|
-
*/
|
|
261
|
-
export function isPascal(): never {
|
|
262
|
-
return halt("isPascal");
|
|
263
|
-
}
|
|
264
|
-
Object.assign(isPascal, Namespace.notations.pascal("isPascal"));
|
|
265
|
-
Object.assign(isPascal, Namespace.is());
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Converts to pascal case with type validation.
|
|
269
|
-
*
|
|
270
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
271
|
-
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
272
|
-
* object. Otherwise, there's no problem on the input value, pascal cased converted data
|
|
273
|
-
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
274
|
-
*
|
|
275
|
-
* @template T Type of the input value
|
|
276
|
-
* @param input Target object
|
|
277
|
-
* @returns Validation result with pascal case object
|
|
278
|
-
*
|
|
279
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
280
|
-
*/
|
|
281
|
-
export function validatePascal<T>(input: T): IValidation<PascalCase<T>>;
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Converts to pascal case with type validation.
|
|
285
|
-
*
|
|
286
|
-
* Convert every property names of nested objects to follow the pascal case convention.
|
|
287
|
-
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
288
|
-
* object. Otherwise, there's no problem on the input value, pascal cased converted data
|
|
289
|
-
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
290
|
-
*
|
|
291
|
-
* @template T Type of the input value
|
|
292
|
-
* @param input Target object
|
|
293
|
-
* @returns Validation result with pascal case object
|
|
294
|
-
*
|
|
295
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
296
|
-
*/
|
|
297
|
-
export function validatePascal<T>(input: unknown): IValidation<PascalCase<T>>;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* @internal
|
|
301
|
-
*/
|
|
302
|
-
export function validatePascal(): never {
|
|
303
|
-
return halt("validatePascal");
|
|
304
|
-
}
|
|
305
|
-
Object.assign(validatePascal, Namespace.notations.pascal("validatePascal"));
|
|
306
|
-
Object.assign(validatePascal, Namespace.validate());
|
|
307
|
-
|
|
308
|
-
/* -----------------------------------------------------------
|
|
309
|
-
SNAKE CASE
|
|
310
|
-
----------------------------------------------------------- */
|
|
311
|
-
/**
|
|
312
|
-
* Convert to snake case.
|
|
313
|
-
*
|
|
314
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
315
|
-
*
|
|
316
|
-
* For reference, this `typia.notations.snake()` function does not validate the input value
|
|
317
|
-
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
318
|
-
* if you can't ensure the input value type, it would be better to call one of them below:
|
|
319
|
-
*
|
|
320
|
-
* - {@link assertSnake}
|
|
321
|
-
* - {@link isSnake}
|
|
322
|
-
* - {@link validateSnake}
|
|
323
|
-
*
|
|
324
|
-
* @template T Type of the input value
|
|
325
|
-
* @param input Target object
|
|
326
|
-
* @returns Snake case object
|
|
327
|
-
*
|
|
328
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
329
|
-
*/
|
|
330
|
-
export function snake<T>(input: T): SnakeCase<T>;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* @internal
|
|
334
|
-
*/
|
|
335
|
-
export function snake(): never {
|
|
336
|
-
return halt("snake");
|
|
337
|
-
}
|
|
338
|
-
Object.assign(snake, Namespace.notations.snake("snake"));
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Converts to snake case with type assertion.
|
|
342
|
-
*
|
|
343
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
344
|
-
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
345
|
-
*
|
|
346
|
-
* @template T Type of the input value
|
|
347
|
-
* @param input Target object
|
|
348
|
-
* @returns Snake case object
|
|
349
|
-
*
|
|
350
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
351
|
-
*/
|
|
352
|
-
export function assertSnake<T>(input: T): SnakeCase<T>;
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Converts to snake case with type assertion.
|
|
356
|
-
*
|
|
357
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
358
|
-
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
359
|
-
*
|
|
360
|
-
* @template T Type of the input value
|
|
361
|
-
* @param input Target object
|
|
362
|
-
* @returns Snake case object
|
|
363
|
-
*
|
|
364
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
365
|
-
*/
|
|
366
|
-
export function assertSnake<T>(input: unknown): SnakeCase<T>;
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* @internal
|
|
370
|
-
*/
|
|
371
|
-
export function assertSnake(): never {
|
|
372
|
-
return halt("assertSnake");
|
|
373
|
-
}
|
|
374
|
-
Object.assign(assertSnake, Namespace.notations.snake("assertSnake"));
|
|
375
|
-
Object.assign(assertSnake, Namespace.assert("notations.assertSnake"));
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Converts to snake case with type checking.
|
|
379
|
-
*
|
|
380
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
381
|
-
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
382
|
-
*
|
|
383
|
-
* @template T Type of the input value
|
|
384
|
-
* @param input Target object
|
|
385
|
-
* @returns Snake case object when exact type, otherwise null
|
|
386
|
-
*
|
|
387
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
388
|
-
*/
|
|
389
|
-
export function isSnake<T>(input: T): SnakeCase<T> | null;
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Converts to snake case with type checking.
|
|
393
|
-
*
|
|
394
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
395
|
-
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
396
|
-
*
|
|
397
|
-
* @template T Type of the input value
|
|
398
|
-
* @param input Target object
|
|
399
|
-
* @returns Snake case object when exact type, otherwise null
|
|
400
|
-
*
|
|
401
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
402
|
-
*/
|
|
403
|
-
export function isSnake<T>(input: unknown): SnakeCase<T> | null;
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* @internal
|
|
407
|
-
*/
|
|
408
|
-
export function isSnake(): never {
|
|
409
|
-
return halt("isSnake");
|
|
410
|
-
}
|
|
411
|
-
Object.assign(isSnake, Namespace.notations.snake("isSnake"));
|
|
412
|
-
Object.assign(isSnake, Namespace.is());
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Converts to snake case with type validation.
|
|
416
|
-
*
|
|
417
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
418
|
-
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
419
|
-
* object. Otherwise, there's no problem on the input value, snake cased converted data
|
|
420
|
-
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
421
|
-
*
|
|
422
|
-
* @template T Type of the input value
|
|
423
|
-
* @param input Target object
|
|
424
|
-
* @returns Validation result with snake case object
|
|
425
|
-
*
|
|
426
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
427
|
-
*/
|
|
428
|
-
export function validateSnake<T>(input: T): IValidation<SnakeCase<T>>;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Converts to snake case with type validation.
|
|
432
|
-
*
|
|
433
|
-
* Convert every property names of nested objects to follow the snake case convention.
|
|
434
|
-
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
435
|
-
* object. Otherwise, there's no problem on the input value, snake cased converted data
|
|
436
|
-
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
437
|
-
*
|
|
438
|
-
* @template T Type of the input value
|
|
439
|
-
* @param input Target object
|
|
440
|
-
* @returns Validation result with snake case object
|
|
441
|
-
*
|
|
442
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
443
|
-
*/
|
|
444
|
-
export function validateSnake<T>(input: unknown): IValidation<SnakeCase<T>>;
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* @internal
|
|
448
|
-
*/
|
|
449
|
-
export function validateSnake(): never {
|
|
450
|
-
return halt("validateSnake");
|
|
451
|
-
}
|
|
452
|
-
Object.assign(validateSnake, Namespace.notations.snake("validateSnake"));
|
|
453
|
-
Object.assign(validateSnake, Namespace.validate());
|
|
454
|
-
|
|
455
|
-
/* -----------------------------------------------------------
|
|
456
|
-
FACTORY FUNCTIONS
|
|
457
|
-
----------------------------------------------------------- */
|
|
458
|
-
/**
|
|
459
|
-
* Creates a reusable {@link camel} function.
|
|
460
|
-
*
|
|
461
|
-
* @danger You must configure the generic argument `T`
|
|
462
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
463
|
-
* @throws compile error
|
|
464
|
-
*
|
|
465
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
466
|
-
*/
|
|
467
|
-
export function createCamel(): never;
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Creates a reusable {@link camel} function.
|
|
471
|
-
*
|
|
472
|
-
* @template T Type of the input value
|
|
473
|
-
* @returns A reusable `camel` function
|
|
474
|
-
*
|
|
475
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
476
|
-
*/
|
|
477
|
-
export function createCamel<T>(): (input: T) => CamelCase<T>;
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* @internal
|
|
481
|
-
*/
|
|
482
|
-
export function createCamel(): never {
|
|
483
|
-
halt("createCamel");
|
|
484
|
-
}
|
|
485
|
-
Object.assign(createCamel, Namespace.notations.camel("createCamel"));
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Creates a reusable {@link assertCamel} function.
|
|
489
|
-
*
|
|
490
|
-
* @danger You must configure the generic argument `T`
|
|
491
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
492
|
-
* @throws compile error
|
|
493
|
-
*
|
|
494
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
495
|
-
*/
|
|
496
|
-
export function createAssertCamel(): never;
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Creates a reusable {@link assertCamel} function.
|
|
500
|
-
*
|
|
501
|
-
* @template T Type of the input value
|
|
502
|
-
* @returns A reusable `assertCamel` function
|
|
503
|
-
*
|
|
504
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
505
|
-
*/
|
|
506
|
-
export function createAssertCamel<T>(): (input: T) => CamelCase<T>;
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* @internal
|
|
510
|
-
*/
|
|
511
|
-
export function createAssertCamel(): never {
|
|
512
|
-
halt("createAssertCamel");
|
|
513
|
-
}
|
|
514
|
-
Object.assign(
|
|
515
|
-
createAssertCamel,
|
|
516
|
-
Namespace.notations.camel("createAssertCamel"),
|
|
517
|
-
);
|
|
518
|
-
Object.assign(
|
|
519
|
-
createAssertCamel,
|
|
520
|
-
Namespace.assert("notations.createAssertCamel"),
|
|
521
|
-
);
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Creates a reusable {@link isCamel} function.
|
|
525
|
-
*
|
|
526
|
-
* @danger You must configure the generic argument `T`
|
|
527
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
528
|
-
* @throws compile error
|
|
529
|
-
*
|
|
530
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
531
|
-
*/
|
|
532
|
-
export function createIsCamel(): never;
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Creates a reusable {@link isCamel} function.
|
|
536
|
-
*
|
|
537
|
-
* @template T Type of the input value
|
|
538
|
-
* @returns A reusable `isCamel` function
|
|
539
|
-
*
|
|
540
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
541
|
-
*/
|
|
542
|
-
export function createIsCamel<T>(): (input: T) => CamelCase<T> | null;
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* @internal
|
|
546
|
-
*/
|
|
547
|
-
export function createIsCamel(): never {
|
|
548
|
-
halt("createIsCamel");
|
|
549
|
-
}
|
|
550
|
-
Object.assign(createIsCamel, Namespace.notations.camel("createIsCamel"));
|
|
551
|
-
Object.assign(createIsCamel, Namespace.is());
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Creates a reusable {@link validateCamel} function.
|
|
555
|
-
*
|
|
556
|
-
* @danger You must configure the generic argument `T`
|
|
557
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
558
|
-
* @throws compile error
|
|
559
|
-
*
|
|
560
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
561
|
-
*/
|
|
562
|
-
export function createValidateCamel(): never;
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Creates a reusable {@link validateCamel} function.
|
|
566
|
-
*
|
|
567
|
-
* @template T Type of the input value
|
|
568
|
-
* @returns A reusable `validateCamel` function
|
|
569
|
-
*
|
|
570
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
571
|
-
*/
|
|
572
|
-
export function createValidateCamel<T>(): (
|
|
573
|
-
input: T,
|
|
574
|
-
) => IValidation<CamelCase<T>>;
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* @internal
|
|
578
|
-
*/
|
|
579
|
-
export function createValidateCamel(): never {
|
|
580
|
-
halt("createValidateCamel");
|
|
581
|
-
}
|
|
582
|
-
Object.assign(
|
|
583
|
-
createValidateCamel,
|
|
584
|
-
Namespace.notations.camel("createValidateCamel"),
|
|
585
|
-
);
|
|
586
|
-
Object.assign(createValidateCamel, Namespace.validate());
|
|
587
|
-
|
|
588
|
-
/**
|
|
589
|
-
* Creates a reusable {@link pascal} function.
|
|
590
|
-
*
|
|
591
|
-
* @danger You must configure the generic argument `T`
|
|
592
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
593
|
-
* @throws compile error
|
|
594
|
-
*
|
|
595
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
596
|
-
*/
|
|
597
|
-
export function createPascal(): never;
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* Creates a reusable {@link pascal} function.
|
|
601
|
-
*
|
|
602
|
-
* @template T Type of the input value
|
|
603
|
-
* @returns A reusable `pascal` function
|
|
604
|
-
*
|
|
605
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
606
|
-
*/
|
|
607
|
-
export function createPascal<T>(): (input: T) => PascalCase<T>;
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* @internal
|
|
611
|
-
*/
|
|
612
|
-
export function createPascal(): never {
|
|
613
|
-
halt("createPascal");
|
|
614
|
-
}
|
|
615
|
-
Object.assign(createPascal, Namespace.notations.pascal("createPascal"));
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* Creates a reusable {@link assertPascal} function.
|
|
619
|
-
*
|
|
620
|
-
* @danger You must configure the generic argument `T`
|
|
621
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
622
|
-
* @throws compile error
|
|
623
|
-
*
|
|
624
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
625
|
-
*/
|
|
626
|
-
export function createAssertPascal(): never;
|
|
627
|
-
|
|
628
|
-
/**
|
|
629
|
-
* Creates a reusable {@link assertPascal} function.
|
|
630
|
-
*
|
|
631
|
-
* @template T Type of the input value
|
|
632
|
-
* @returns A reusable `assertPascal` function
|
|
633
|
-
*
|
|
634
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
635
|
-
*/
|
|
636
|
-
export function createAssertPascal<T>(): (input: T) => PascalCase<T>;
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* @internal
|
|
640
|
-
*/
|
|
641
|
-
export function createAssertPascal(): never {
|
|
642
|
-
halt("createAssertPascal");
|
|
643
|
-
}
|
|
644
|
-
Object.assign(
|
|
645
|
-
createAssertPascal,
|
|
646
|
-
Namespace.notations.pascal("createAssertPascal"),
|
|
647
|
-
);
|
|
648
|
-
Object.assign(
|
|
649
|
-
createAssertPascal,
|
|
650
|
-
Namespace.assert("notations.createAssertPascal"),
|
|
651
|
-
);
|
|
652
|
-
|
|
653
|
-
/**
|
|
654
|
-
* Creates a reusable {@link isPascal} function.
|
|
655
|
-
*
|
|
656
|
-
* @danger You must configure the generic argument `T`
|
|
657
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
658
|
-
* @throws compile error
|
|
659
|
-
*
|
|
660
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
661
|
-
*/
|
|
662
|
-
export function createIsPascal(): never;
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Creates a reusable {@link isPascal} function.
|
|
666
|
-
*
|
|
667
|
-
* @template T Type of the input value
|
|
668
|
-
* @returns A reusable `isPascal` function
|
|
669
|
-
*
|
|
670
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
671
|
-
*/
|
|
672
|
-
export function createIsPascal<T>(): (input: T) => PascalCase<T> | null;
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* @internal
|
|
676
|
-
*/
|
|
677
|
-
export function createIsPascal(): never {
|
|
678
|
-
halt("createIsPascal");
|
|
679
|
-
}
|
|
680
|
-
Object.assign(createIsPascal, Namespace.notations.pascal("createIsPascal"));
|
|
681
|
-
Object.assign(createIsPascal, Namespace.is());
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Creates a reusable {@link validatePascal} function.
|
|
685
|
-
*
|
|
686
|
-
* @danger You must configure the generic argument `T`
|
|
687
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
688
|
-
* @throws compile error
|
|
689
|
-
*
|
|
690
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
691
|
-
*/
|
|
692
|
-
export function createValidatePascal(): never;
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* Creates a reusable {@link validatePascal} function.
|
|
696
|
-
*
|
|
697
|
-
* @template T Type of the input value
|
|
698
|
-
* @returns A reusable `validatePascal` function
|
|
699
|
-
*
|
|
700
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
701
|
-
*/
|
|
702
|
-
export function createValidatePascal<T>(): (
|
|
703
|
-
input: T,
|
|
704
|
-
) => IValidation<PascalCase<T>>;
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* @internal
|
|
708
|
-
*/
|
|
709
|
-
export function createValidatePascal(): never {
|
|
710
|
-
halt("createValidatePascal");
|
|
711
|
-
}
|
|
712
|
-
Object.assign(
|
|
713
|
-
createValidatePascal,
|
|
714
|
-
Namespace.notations.pascal("createValidatePascal"),
|
|
715
|
-
);
|
|
716
|
-
Object.assign(createValidatePascal, Namespace.validate());
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* Creates a reusable {@link snake} function.
|
|
720
|
-
*
|
|
721
|
-
* @danger You must configure the generic argument `T`
|
|
722
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
723
|
-
* @throws compile error
|
|
724
|
-
*
|
|
725
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
726
|
-
*/
|
|
727
|
-
export function createSnake(): never;
|
|
728
|
-
|
|
729
|
-
/**
|
|
730
|
-
* Creates a reusable {@link snake} function.
|
|
731
|
-
*
|
|
732
|
-
* @template T Type of the input value
|
|
733
|
-
* @returns A reusable `snake` function
|
|
734
|
-
*
|
|
735
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
736
|
-
*/
|
|
737
|
-
export function createSnake<T>(): (input: T) => SnakeCase<T>;
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* @internal
|
|
741
|
-
*/
|
|
742
|
-
export function createSnake(): never {
|
|
743
|
-
halt("createSnake");
|
|
744
|
-
}
|
|
745
|
-
Object.assign(createSnake, Namespace.notations.snake("createSnake"));
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Creates a reusable {@link assertSnake} function.
|
|
749
|
-
*
|
|
750
|
-
* @danger You must configure the generic argument `T`
|
|
751
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
752
|
-
* @throws compile error
|
|
753
|
-
*
|
|
754
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
755
|
-
*/
|
|
756
|
-
export function createAssertSnake(): never;
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
* Creates a reusable {@link assertSnake} function.
|
|
760
|
-
*
|
|
761
|
-
* @template T Type of the input value
|
|
762
|
-
* @returns A reusable `assertSnake` function
|
|
763
|
-
*
|
|
764
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
765
|
-
*/
|
|
766
|
-
export function createAssertSnake<T>(): (input: T) => SnakeCase<T>;
|
|
767
|
-
|
|
768
|
-
/**
|
|
769
|
-
* @internal
|
|
770
|
-
*/
|
|
771
|
-
export function createAssertSnake(): never {
|
|
772
|
-
halt("createAssertSnake");
|
|
773
|
-
}
|
|
774
|
-
Object.assign(
|
|
775
|
-
createAssertSnake,
|
|
776
|
-
Namespace.notations.snake("createAssertSnake"),
|
|
777
|
-
);
|
|
778
|
-
Object.assign(
|
|
779
|
-
createAssertSnake,
|
|
780
|
-
Namespace.assert("notations.createAssertSnake"),
|
|
781
|
-
);
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Creates a reusable {@link isSnake} function.
|
|
785
|
-
*
|
|
786
|
-
* @danger You must configure the generic argument `T`
|
|
787
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
788
|
-
* @throws compile error
|
|
789
|
-
*
|
|
790
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
791
|
-
*/
|
|
792
|
-
export function createIsSnake(): never;
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* Creates a reusable {@link isSnake} function.
|
|
796
|
-
*
|
|
797
|
-
* @template T Type of the input value
|
|
798
|
-
* @returns A reusable `isSnake` function
|
|
799
|
-
*
|
|
800
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
801
|
-
*/
|
|
802
|
-
export function createIsSnake<T>(): (input: T) => SnakeCase<T> | null;
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* @internal
|
|
806
|
-
*/
|
|
807
|
-
export function createIsSnake(): never {
|
|
808
|
-
halt("createIsSnake");
|
|
809
|
-
}
|
|
810
|
-
Object.assign(createIsSnake, Namespace.notations.snake("createIsSnake"));
|
|
811
|
-
Object.assign(createIsSnake, Namespace.is());
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* Creates a reusable {@link validateSnake} function.
|
|
815
|
-
*
|
|
816
|
-
* @danger You must configure the generic argument `T`
|
|
817
|
-
* @returns Nothing until be configure the generic argument `T`
|
|
818
|
-
* @throws compile error
|
|
819
|
-
*
|
|
820
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
821
|
-
*/
|
|
822
|
-
export function createValidateSnake(): never;
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Creates a reusable {@link validateSnake} function.
|
|
826
|
-
*
|
|
827
|
-
* @template T Type of the input value
|
|
828
|
-
* @returns A reusable `validateSnake` function
|
|
829
|
-
*
|
|
830
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
831
|
-
*/
|
|
832
|
-
export function createValidateSnake<T>(): (
|
|
833
|
-
input: T,
|
|
834
|
-
) => IValidation<SnakeCase<T>>;
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* @internal
|
|
838
|
-
*/
|
|
839
|
-
export function createValidateSnake(): never {
|
|
840
|
-
halt("createValidateSnake");
|
|
841
|
-
}
|
|
842
|
-
Object.assign(
|
|
843
|
-
createValidateSnake,
|
|
844
|
-
Namespace.notations.snake("createValidateSnake"),
|
|
845
|
-
);
|
|
846
|
-
Object.assign(createValidateSnake, Namespace.validate());
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* @internal
|
|
850
|
-
*/
|
|
851
|
-
function halt(name: string): never {
|
|
852
|
-
throw new Error(
|
|
853
|
-
`Error on typia.notations.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
854
|
-
);
|
|
855
|
-
}
|
|
1
|
+
import { Namespace } from "./functional/Namespace";
|
|
2
|
+
|
|
3
|
+
import { CamelCase } from "./CamelCase";
|
|
4
|
+
import { IValidation } from "./IValidation";
|
|
5
|
+
import { PascalCase } from "./PascalCase";
|
|
6
|
+
import { SnakeCase } from "./SnakeCase";
|
|
7
|
+
|
|
8
|
+
/* ===========================================================
|
|
9
|
+
NOTATIONS (NAMING CONVENTIONS)
|
|
10
|
+
- CAMEL CASE
|
|
11
|
+
- PASCAL CASE
|
|
12
|
+
- SNAKE CASE
|
|
13
|
+
- FACTORY FUNCTIONS
|
|
14
|
+
==============================================================
|
|
15
|
+
CAMEL CASE
|
|
16
|
+
----------------------------------------------------------- */
|
|
17
|
+
/**
|
|
18
|
+
* Convert to camel case.
|
|
19
|
+
*
|
|
20
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
21
|
+
*
|
|
22
|
+
* For reference, this `typia.notations.camel()` function does not validate the input value
|
|
23
|
+
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
24
|
+
* if you can't ensure the input value type, it would be better to call one of them below:
|
|
25
|
+
*
|
|
26
|
+
* - {@link assertCamel}
|
|
27
|
+
* - {@link isCamel}
|
|
28
|
+
* - {@link validateCamel}
|
|
29
|
+
*
|
|
30
|
+
* @template T Type of the input value
|
|
31
|
+
* @param input Target object
|
|
32
|
+
* @returns Camel case object
|
|
33
|
+
*
|
|
34
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
35
|
+
*/
|
|
36
|
+
export function camel<T>(input: T): CamelCase<T>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export function camel(): never {
|
|
42
|
+
return halt("camel");
|
|
43
|
+
}
|
|
44
|
+
Object.assign(camel, Namespace.notations.camel("camel"));
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Converts to camel case with type assertion.
|
|
48
|
+
*
|
|
49
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
50
|
+
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
51
|
+
*
|
|
52
|
+
* @template T Type of the input value
|
|
53
|
+
* @param input Target object
|
|
54
|
+
* @returns Camel case object
|
|
55
|
+
*
|
|
56
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
57
|
+
*/
|
|
58
|
+
export function assertCamel<T>(input: T): CamelCase<T>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Converts to camel case with type assertion.
|
|
62
|
+
*
|
|
63
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
64
|
+
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
65
|
+
*
|
|
66
|
+
* @template T Type of the input value
|
|
67
|
+
* @param input Target object
|
|
68
|
+
* @returns Camel case object
|
|
69
|
+
*
|
|
70
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
71
|
+
*/
|
|
72
|
+
export function assertCamel<T>(input: unknown): CamelCase<T>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export function assertCamel(): never {
|
|
78
|
+
return halt("assertCamel");
|
|
79
|
+
}
|
|
80
|
+
Object.assign(assertCamel, Namespace.notations.camel("assertCamel"));
|
|
81
|
+
Object.assign(assertCamel, Namespace.assert("notations.assertCamel"));
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Converts to camel case with type checking.
|
|
85
|
+
*
|
|
86
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
87
|
+
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
88
|
+
*
|
|
89
|
+
* @template T Type of the input value
|
|
90
|
+
* @param input Target object
|
|
91
|
+
* @returns Camel case object when exact type, otherwise null
|
|
92
|
+
*
|
|
93
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
94
|
+
*/
|
|
95
|
+
export function isCamel<T>(input: T): CamelCase<T> | null;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Converts to camel case with type checking.
|
|
99
|
+
*
|
|
100
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
101
|
+
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
102
|
+
*
|
|
103
|
+
* @template T Type of the input value
|
|
104
|
+
* @param input Target object
|
|
105
|
+
* @returns Camel case object when exact type, otherwise null
|
|
106
|
+
*
|
|
107
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
108
|
+
*/
|
|
109
|
+
export function isCamel<T>(input: unknown): CamelCase<T> | null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
export function isCamel(): never {
|
|
115
|
+
return halt("isCamel");
|
|
116
|
+
}
|
|
117
|
+
Object.assign(isCamel, Namespace.notations.camel("isCamel"));
|
|
118
|
+
Object.assign(isCamel, Namespace.is());
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Converts to camel case with type validation.
|
|
122
|
+
*
|
|
123
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
124
|
+
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
125
|
+
* object. Otherwise, there's no problem on the input value, camel cased converted data
|
|
126
|
+
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
127
|
+
*
|
|
128
|
+
* @template T Type of the input value
|
|
129
|
+
* @param input Target object
|
|
130
|
+
* @returns Validation result with camel case object
|
|
131
|
+
*
|
|
132
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
133
|
+
*/
|
|
134
|
+
export function validateCamel<T>(input: T): IValidation<CamelCase<T>>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Converts to camel case with type validation.
|
|
138
|
+
*
|
|
139
|
+
* Convert every property names of nested objects to follow the camel case convention.
|
|
140
|
+
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
141
|
+
* object. Otherwise, there's no problem on the input value, camel cased converted data
|
|
142
|
+
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
143
|
+
*
|
|
144
|
+
* @template T Type of the input value
|
|
145
|
+
* @param input Target object
|
|
146
|
+
* @returns Validation result with camel case object
|
|
147
|
+
*
|
|
148
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
149
|
+
*/
|
|
150
|
+
export function validateCamel<T>(input: unknown): IValidation<CamelCase<T>>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
export function validateCamel(): never {
|
|
156
|
+
return halt("validateCamel");
|
|
157
|
+
}
|
|
158
|
+
Object.assign(validateCamel, Namespace.notations.camel("validateCamel"));
|
|
159
|
+
Object.assign(validateCamel, Namespace.validate());
|
|
160
|
+
|
|
161
|
+
/* -----------------------------------------------------------
|
|
162
|
+
PASCAL CASE
|
|
163
|
+
----------------------------------------------------------- */
|
|
164
|
+
/**
|
|
165
|
+
* Convert to pascal case.
|
|
166
|
+
*
|
|
167
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
168
|
+
*
|
|
169
|
+
* For reference, this `typia.notations.pascal()` function does not validate the input value
|
|
170
|
+
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
171
|
+
* if you can't ensure the input value type, it would be better to call one of them below:
|
|
172
|
+
*
|
|
173
|
+
* - {@link assertPascal}
|
|
174
|
+
* - {@link isPascal}
|
|
175
|
+
* - {@link validatePascal}
|
|
176
|
+
*
|
|
177
|
+
* @template T Type of the input value
|
|
178
|
+
* @param input Target object
|
|
179
|
+
* @returns Pascal case object
|
|
180
|
+
*
|
|
181
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
182
|
+
*/
|
|
183
|
+
export function pascal<T>(input: T): PascalCase<T>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
export function pascal(): never {
|
|
189
|
+
return halt("pascal");
|
|
190
|
+
}
|
|
191
|
+
Object.assign(pascal, Namespace.notations.pascal("pascal"));
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Converts to pascal case with type assertion.
|
|
195
|
+
*
|
|
196
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
197
|
+
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
198
|
+
*
|
|
199
|
+
* @template T Type of the input value
|
|
200
|
+
* @param input Target object
|
|
201
|
+
* @returns Pascal case object
|
|
202
|
+
*
|
|
203
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
204
|
+
*/
|
|
205
|
+
export function assertPascal<T>(input: T): PascalCase<T>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Converts to pascal case with type assertion.
|
|
209
|
+
*
|
|
210
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
211
|
+
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
212
|
+
*
|
|
213
|
+
* @template T Type of the input value
|
|
214
|
+
* @param input Target object
|
|
215
|
+
* @returns Pascal case object
|
|
216
|
+
*
|
|
217
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
218
|
+
*/
|
|
219
|
+
export function assertPascal<T>(input: unknown): PascalCase<T>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
export function assertPascal(): never {
|
|
225
|
+
return halt("assertPascal");
|
|
226
|
+
}
|
|
227
|
+
Object.assign(assertPascal, Namespace.notations.pascal("assertPascal"));
|
|
228
|
+
Object.assign(assertPascal, Namespace.assert("notations.assertPascal"));
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Converts to pascal case with type checking.
|
|
232
|
+
*
|
|
233
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
234
|
+
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
235
|
+
*
|
|
236
|
+
* @template T Type of the input value
|
|
237
|
+
* @param input Target object
|
|
238
|
+
* @returns Pascal case object when exact type, otherwise null
|
|
239
|
+
*
|
|
240
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
241
|
+
*/
|
|
242
|
+
export function isPascal<T>(input: T): PascalCase<T> | null;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Converts to pascal case with type checking.
|
|
246
|
+
*
|
|
247
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
248
|
+
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
249
|
+
*
|
|
250
|
+
* @template T Type of the input value
|
|
251
|
+
* @param input Target object
|
|
252
|
+
* @returns Pascal case object when exact type, otherwise null
|
|
253
|
+
*
|
|
254
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
255
|
+
*/
|
|
256
|
+
export function isPascal<T>(input: unknown): PascalCase<T> | null;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @internal
|
|
260
|
+
*/
|
|
261
|
+
export function isPascal(): never {
|
|
262
|
+
return halt("isPascal");
|
|
263
|
+
}
|
|
264
|
+
Object.assign(isPascal, Namespace.notations.pascal("isPascal"));
|
|
265
|
+
Object.assign(isPascal, Namespace.is());
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Converts to pascal case with type validation.
|
|
269
|
+
*
|
|
270
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
271
|
+
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
272
|
+
* object. Otherwise, there's no problem on the input value, pascal cased converted data
|
|
273
|
+
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
274
|
+
*
|
|
275
|
+
* @template T Type of the input value
|
|
276
|
+
* @param input Target object
|
|
277
|
+
* @returns Validation result with pascal case object
|
|
278
|
+
*
|
|
279
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
280
|
+
*/
|
|
281
|
+
export function validatePascal<T>(input: T): IValidation<PascalCase<T>>;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Converts to pascal case with type validation.
|
|
285
|
+
*
|
|
286
|
+
* Convert every property names of nested objects to follow the pascal case convention.
|
|
287
|
+
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
288
|
+
* object. Otherwise, there's no problem on the input value, pascal cased converted data
|
|
289
|
+
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
290
|
+
*
|
|
291
|
+
* @template T Type of the input value
|
|
292
|
+
* @param input Target object
|
|
293
|
+
* @returns Validation result with pascal case object
|
|
294
|
+
*
|
|
295
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
296
|
+
*/
|
|
297
|
+
export function validatePascal<T>(input: unknown): IValidation<PascalCase<T>>;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @internal
|
|
301
|
+
*/
|
|
302
|
+
export function validatePascal(): never {
|
|
303
|
+
return halt("validatePascal");
|
|
304
|
+
}
|
|
305
|
+
Object.assign(validatePascal, Namespace.notations.pascal("validatePascal"));
|
|
306
|
+
Object.assign(validatePascal, Namespace.validate());
|
|
307
|
+
|
|
308
|
+
/* -----------------------------------------------------------
|
|
309
|
+
SNAKE CASE
|
|
310
|
+
----------------------------------------------------------- */
|
|
311
|
+
/**
|
|
312
|
+
* Convert to snake case.
|
|
313
|
+
*
|
|
314
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
315
|
+
*
|
|
316
|
+
* For reference, this `typia.notations.snake()` function does not validate the input value
|
|
317
|
+
* type. It just believes that the input value is following the type `T`. Therefore,
|
|
318
|
+
* if you can't ensure the input value type, it would be better to call one of them below:
|
|
319
|
+
*
|
|
320
|
+
* - {@link assertSnake}
|
|
321
|
+
* - {@link isSnake}
|
|
322
|
+
* - {@link validateSnake}
|
|
323
|
+
*
|
|
324
|
+
* @template T Type of the input value
|
|
325
|
+
* @param input Target object
|
|
326
|
+
* @returns Snake case object
|
|
327
|
+
*
|
|
328
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
329
|
+
*/
|
|
330
|
+
export function snake<T>(input: T): SnakeCase<T>;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @internal
|
|
334
|
+
*/
|
|
335
|
+
export function snake(): never {
|
|
336
|
+
return halt("snake");
|
|
337
|
+
}
|
|
338
|
+
Object.assign(snake, Namespace.notations.snake("snake"));
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Converts to snake case with type assertion.
|
|
342
|
+
*
|
|
343
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
344
|
+
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
345
|
+
*
|
|
346
|
+
* @template T Type of the input value
|
|
347
|
+
* @param input Target object
|
|
348
|
+
* @returns Snake case object
|
|
349
|
+
*
|
|
350
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
351
|
+
*/
|
|
352
|
+
export function assertSnake<T>(input: T): SnakeCase<T>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Converts to snake case with type assertion.
|
|
356
|
+
*
|
|
357
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
358
|
+
* If the input value does not follow the type `T`, it throws {@link TypeGuardError}.
|
|
359
|
+
*
|
|
360
|
+
* @template T Type of the input value
|
|
361
|
+
* @param input Target object
|
|
362
|
+
* @returns Snake case object
|
|
363
|
+
*
|
|
364
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
365
|
+
*/
|
|
366
|
+
export function assertSnake<T>(input: unknown): SnakeCase<T>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @internal
|
|
370
|
+
*/
|
|
371
|
+
export function assertSnake(): never {
|
|
372
|
+
return halt("assertSnake");
|
|
373
|
+
}
|
|
374
|
+
Object.assign(assertSnake, Namespace.notations.snake("assertSnake"));
|
|
375
|
+
Object.assign(assertSnake, Namespace.assert("notations.assertSnake"));
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Converts to snake case with type checking.
|
|
379
|
+
*
|
|
380
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
381
|
+
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
382
|
+
*
|
|
383
|
+
* @template T Type of the input value
|
|
384
|
+
* @param input Target object
|
|
385
|
+
* @returns Snake case object when exact type, otherwise null
|
|
386
|
+
*
|
|
387
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
388
|
+
*/
|
|
389
|
+
export function isSnake<T>(input: T): SnakeCase<T> | null;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Converts to snake case with type checking.
|
|
393
|
+
*
|
|
394
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
395
|
+
* If the input value does not follow the type `T`, it returns `null` value instead.
|
|
396
|
+
*
|
|
397
|
+
* @template T Type of the input value
|
|
398
|
+
* @param input Target object
|
|
399
|
+
* @returns Snake case object when exact type, otherwise null
|
|
400
|
+
*
|
|
401
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
402
|
+
*/
|
|
403
|
+
export function isSnake<T>(input: unknown): SnakeCase<T> | null;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* @internal
|
|
407
|
+
*/
|
|
408
|
+
export function isSnake(): never {
|
|
409
|
+
return halt("isSnake");
|
|
410
|
+
}
|
|
411
|
+
Object.assign(isSnake, Namespace.notations.snake("isSnake"));
|
|
412
|
+
Object.assign(isSnake, Namespace.is());
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Converts to snake case with type validation.
|
|
416
|
+
*
|
|
417
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
418
|
+
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
419
|
+
* object. Otherwise, there's no problem on the input value, snake cased converted data
|
|
420
|
+
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
421
|
+
*
|
|
422
|
+
* @template T Type of the input value
|
|
423
|
+
* @param input Target object
|
|
424
|
+
* @returns Validation result with snake case object
|
|
425
|
+
*
|
|
426
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
427
|
+
*/
|
|
428
|
+
export function validateSnake<T>(input: T): IValidation<SnakeCase<T>>;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Converts to snake case with type validation.
|
|
432
|
+
*
|
|
433
|
+
* Convert every property names of nested objects to follow the snake case convention.
|
|
434
|
+
* If the input value does not follow the type `T`, it returns {@link IValidation.Failure}
|
|
435
|
+
* object. Otherwise, there's no problem on the input value, snake cased converted data
|
|
436
|
+
* would be stored in the `data` property of the output {@link IValidation.Success} object.
|
|
437
|
+
*
|
|
438
|
+
* @template T Type of the input value
|
|
439
|
+
* @param input Target object
|
|
440
|
+
* @returns Validation result with snake case object
|
|
441
|
+
*
|
|
442
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
443
|
+
*/
|
|
444
|
+
export function validateSnake<T>(input: unknown): IValidation<SnakeCase<T>>;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* @internal
|
|
448
|
+
*/
|
|
449
|
+
export function validateSnake(): never {
|
|
450
|
+
return halt("validateSnake");
|
|
451
|
+
}
|
|
452
|
+
Object.assign(validateSnake, Namespace.notations.snake("validateSnake"));
|
|
453
|
+
Object.assign(validateSnake, Namespace.validate());
|
|
454
|
+
|
|
455
|
+
/* -----------------------------------------------------------
|
|
456
|
+
FACTORY FUNCTIONS
|
|
457
|
+
----------------------------------------------------------- */
|
|
458
|
+
/**
|
|
459
|
+
* Creates a reusable {@link camel} function.
|
|
460
|
+
*
|
|
461
|
+
* @danger You must configure the generic argument `T`
|
|
462
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
463
|
+
* @throws compile error
|
|
464
|
+
*
|
|
465
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
466
|
+
*/
|
|
467
|
+
export function createCamel(): never;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Creates a reusable {@link camel} function.
|
|
471
|
+
*
|
|
472
|
+
* @template T Type of the input value
|
|
473
|
+
* @returns A reusable `camel` function
|
|
474
|
+
*
|
|
475
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
476
|
+
*/
|
|
477
|
+
export function createCamel<T>(): (input: T) => CamelCase<T>;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* @internal
|
|
481
|
+
*/
|
|
482
|
+
export function createCamel(): never {
|
|
483
|
+
halt("createCamel");
|
|
484
|
+
}
|
|
485
|
+
Object.assign(createCamel, Namespace.notations.camel("createCamel"));
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Creates a reusable {@link assertCamel} function.
|
|
489
|
+
*
|
|
490
|
+
* @danger You must configure the generic argument `T`
|
|
491
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
492
|
+
* @throws compile error
|
|
493
|
+
*
|
|
494
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
495
|
+
*/
|
|
496
|
+
export function createAssertCamel(): never;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Creates a reusable {@link assertCamel} function.
|
|
500
|
+
*
|
|
501
|
+
* @template T Type of the input value
|
|
502
|
+
* @returns A reusable `assertCamel` function
|
|
503
|
+
*
|
|
504
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
505
|
+
*/
|
|
506
|
+
export function createAssertCamel<T>(): (input: T) => CamelCase<T>;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* @internal
|
|
510
|
+
*/
|
|
511
|
+
export function createAssertCamel(): never {
|
|
512
|
+
halt("createAssertCamel");
|
|
513
|
+
}
|
|
514
|
+
Object.assign(
|
|
515
|
+
createAssertCamel,
|
|
516
|
+
Namespace.notations.camel("createAssertCamel"),
|
|
517
|
+
);
|
|
518
|
+
Object.assign(
|
|
519
|
+
createAssertCamel,
|
|
520
|
+
Namespace.assert("notations.createAssertCamel"),
|
|
521
|
+
);
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Creates a reusable {@link isCamel} function.
|
|
525
|
+
*
|
|
526
|
+
* @danger You must configure the generic argument `T`
|
|
527
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
528
|
+
* @throws compile error
|
|
529
|
+
*
|
|
530
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
531
|
+
*/
|
|
532
|
+
export function createIsCamel(): never;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Creates a reusable {@link isCamel} function.
|
|
536
|
+
*
|
|
537
|
+
* @template T Type of the input value
|
|
538
|
+
* @returns A reusable `isCamel` function
|
|
539
|
+
*
|
|
540
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
541
|
+
*/
|
|
542
|
+
export function createIsCamel<T>(): (input: T) => CamelCase<T> | null;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* @internal
|
|
546
|
+
*/
|
|
547
|
+
export function createIsCamel(): never {
|
|
548
|
+
halt("createIsCamel");
|
|
549
|
+
}
|
|
550
|
+
Object.assign(createIsCamel, Namespace.notations.camel("createIsCamel"));
|
|
551
|
+
Object.assign(createIsCamel, Namespace.is());
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Creates a reusable {@link validateCamel} function.
|
|
555
|
+
*
|
|
556
|
+
* @danger You must configure the generic argument `T`
|
|
557
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
558
|
+
* @throws compile error
|
|
559
|
+
*
|
|
560
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
561
|
+
*/
|
|
562
|
+
export function createValidateCamel(): never;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Creates a reusable {@link validateCamel} function.
|
|
566
|
+
*
|
|
567
|
+
* @template T Type of the input value
|
|
568
|
+
* @returns A reusable `validateCamel` function
|
|
569
|
+
*
|
|
570
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
571
|
+
*/
|
|
572
|
+
export function createValidateCamel<T>(): (
|
|
573
|
+
input: T,
|
|
574
|
+
) => IValidation<CamelCase<T>>;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* @internal
|
|
578
|
+
*/
|
|
579
|
+
export function createValidateCamel(): never {
|
|
580
|
+
halt("createValidateCamel");
|
|
581
|
+
}
|
|
582
|
+
Object.assign(
|
|
583
|
+
createValidateCamel,
|
|
584
|
+
Namespace.notations.camel("createValidateCamel"),
|
|
585
|
+
);
|
|
586
|
+
Object.assign(createValidateCamel, Namespace.validate());
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Creates a reusable {@link pascal} function.
|
|
590
|
+
*
|
|
591
|
+
* @danger You must configure the generic argument `T`
|
|
592
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
593
|
+
* @throws compile error
|
|
594
|
+
*
|
|
595
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
596
|
+
*/
|
|
597
|
+
export function createPascal(): never;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Creates a reusable {@link pascal} function.
|
|
601
|
+
*
|
|
602
|
+
* @template T Type of the input value
|
|
603
|
+
* @returns A reusable `pascal` function
|
|
604
|
+
*
|
|
605
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
606
|
+
*/
|
|
607
|
+
export function createPascal<T>(): (input: T) => PascalCase<T>;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* @internal
|
|
611
|
+
*/
|
|
612
|
+
export function createPascal(): never {
|
|
613
|
+
halt("createPascal");
|
|
614
|
+
}
|
|
615
|
+
Object.assign(createPascal, Namespace.notations.pascal("createPascal"));
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Creates a reusable {@link assertPascal} function.
|
|
619
|
+
*
|
|
620
|
+
* @danger You must configure the generic argument `T`
|
|
621
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
622
|
+
* @throws compile error
|
|
623
|
+
*
|
|
624
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
625
|
+
*/
|
|
626
|
+
export function createAssertPascal(): never;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Creates a reusable {@link assertPascal} function.
|
|
630
|
+
*
|
|
631
|
+
* @template T Type of the input value
|
|
632
|
+
* @returns A reusable `assertPascal` function
|
|
633
|
+
*
|
|
634
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
635
|
+
*/
|
|
636
|
+
export function createAssertPascal<T>(): (input: T) => PascalCase<T>;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* @internal
|
|
640
|
+
*/
|
|
641
|
+
export function createAssertPascal(): never {
|
|
642
|
+
halt("createAssertPascal");
|
|
643
|
+
}
|
|
644
|
+
Object.assign(
|
|
645
|
+
createAssertPascal,
|
|
646
|
+
Namespace.notations.pascal("createAssertPascal"),
|
|
647
|
+
);
|
|
648
|
+
Object.assign(
|
|
649
|
+
createAssertPascal,
|
|
650
|
+
Namespace.assert("notations.createAssertPascal"),
|
|
651
|
+
);
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Creates a reusable {@link isPascal} function.
|
|
655
|
+
*
|
|
656
|
+
* @danger You must configure the generic argument `T`
|
|
657
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
658
|
+
* @throws compile error
|
|
659
|
+
*
|
|
660
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
661
|
+
*/
|
|
662
|
+
export function createIsPascal(): never;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Creates a reusable {@link isPascal} function.
|
|
666
|
+
*
|
|
667
|
+
* @template T Type of the input value
|
|
668
|
+
* @returns A reusable `isPascal` function
|
|
669
|
+
*
|
|
670
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
671
|
+
*/
|
|
672
|
+
export function createIsPascal<T>(): (input: T) => PascalCase<T> | null;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @internal
|
|
676
|
+
*/
|
|
677
|
+
export function createIsPascal(): never {
|
|
678
|
+
halt("createIsPascal");
|
|
679
|
+
}
|
|
680
|
+
Object.assign(createIsPascal, Namespace.notations.pascal("createIsPascal"));
|
|
681
|
+
Object.assign(createIsPascal, Namespace.is());
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Creates a reusable {@link validatePascal} function.
|
|
685
|
+
*
|
|
686
|
+
* @danger You must configure the generic argument `T`
|
|
687
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
688
|
+
* @throws compile error
|
|
689
|
+
*
|
|
690
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
691
|
+
*/
|
|
692
|
+
export function createValidatePascal(): never;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Creates a reusable {@link validatePascal} function.
|
|
696
|
+
*
|
|
697
|
+
* @template T Type of the input value
|
|
698
|
+
* @returns A reusable `validatePascal` function
|
|
699
|
+
*
|
|
700
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
701
|
+
*/
|
|
702
|
+
export function createValidatePascal<T>(): (
|
|
703
|
+
input: T,
|
|
704
|
+
) => IValidation<PascalCase<T>>;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* @internal
|
|
708
|
+
*/
|
|
709
|
+
export function createValidatePascal(): never {
|
|
710
|
+
halt("createValidatePascal");
|
|
711
|
+
}
|
|
712
|
+
Object.assign(
|
|
713
|
+
createValidatePascal,
|
|
714
|
+
Namespace.notations.pascal("createValidatePascal"),
|
|
715
|
+
);
|
|
716
|
+
Object.assign(createValidatePascal, Namespace.validate());
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Creates a reusable {@link snake} function.
|
|
720
|
+
*
|
|
721
|
+
* @danger You must configure the generic argument `T`
|
|
722
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
723
|
+
* @throws compile error
|
|
724
|
+
*
|
|
725
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
726
|
+
*/
|
|
727
|
+
export function createSnake(): never;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Creates a reusable {@link snake} function.
|
|
731
|
+
*
|
|
732
|
+
* @template T Type of the input value
|
|
733
|
+
* @returns A reusable `snake` function
|
|
734
|
+
*
|
|
735
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
736
|
+
*/
|
|
737
|
+
export function createSnake<T>(): (input: T) => SnakeCase<T>;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* @internal
|
|
741
|
+
*/
|
|
742
|
+
export function createSnake(): never {
|
|
743
|
+
halt("createSnake");
|
|
744
|
+
}
|
|
745
|
+
Object.assign(createSnake, Namespace.notations.snake("createSnake"));
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Creates a reusable {@link assertSnake} function.
|
|
749
|
+
*
|
|
750
|
+
* @danger You must configure the generic argument `T`
|
|
751
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
752
|
+
* @throws compile error
|
|
753
|
+
*
|
|
754
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
755
|
+
*/
|
|
756
|
+
export function createAssertSnake(): never;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Creates a reusable {@link assertSnake} function.
|
|
760
|
+
*
|
|
761
|
+
* @template T Type of the input value
|
|
762
|
+
* @returns A reusable `assertSnake` function
|
|
763
|
+
*
|
|
764
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
765
|
+
*/
|
|
766
|
+
export function createAssertSnake<T>(): (input: T) => SnakeCase<T>;
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* @internal
|
|
770
|
+
*/
|
|
771
|
+
export function createAssertSnake(): never {
|
|
772
|
+
halt("createAssertSnake");
|
|
773
|
+
}
|
|
774
|
+
Object.assign(
|
|
775
|
+
createAssertSnake,
|
|
776
|
+
Namespace.notations.snake("createAssertSnake"),
|
|
777
|
+
);
|
|
778
|
+
Object.assign(
|
|
779
|
+
createAssertSnake,
|
|
780
|
+
Namespace.assert("notations.createAssertSnake"),
|
|
781
|
+
);
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Creates a reusable {@link isSnake} function.
|
|
785
|
+
*
|
|
786
|
+
* @danger You must configure the generic argument `T`
|
|
787
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
788
|
+
* @throws compile error
|
|
789
|
+
*
|
|
790
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
791
|
+
*/
|
|
792
|
+
export function createIsSnake(): never;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Creates a reusable {@link isSnake} function.
|
|
796
|
+
*
|
|
797
|
+
* @template T Type of the input value
|
|
798
|
+
* @returns A reusable `isSnake` function
|
|
799
|
+
*
|
|
800
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
801
|
+
*/
|
|
802
|
+
export function createIsSnake<T>(): (input: T) => SnakeCase<T> | null;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* @internal
|
|
806
|
+
*/
|
|
807
|
+
export function createIsSnake(): never {
|
|
808
|
+
halt("createIsSnake");
|
|
809
|
+
}
|
|
810
|
+
Object.assign(createIsSnake, Namespace.notations.snake("createIsSnake"));
|
|
811
|
+
Object.assign(createIsSnake, Namespace.is());
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Creates a reusable {@link validateSnake} function.
|
|
815
|
+
*
|
|
816
|
+
* @danger You must configure the generic argument `T`
|
|
817
|
+
* @returns Nothing until be configure the generic argument `T`
|
|
818
|
+
* @throws compile error
|
|
819
|
+
*
|
|
820
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
821
|
+
*/
|
|
822
|
+
export function createValidateSnake(): never;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Creates a reusable {@link validateSnake} function.
|
|
826
|
+
*
|
|
827
|
+
* @template T Type of the input value
|
|
828
|
+
* @returns A reusable `validateSnake` function
|
|
829
|
+
*
|
|
830
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
831
|
+
*/
|
|
832
|
+
export function createValidateSnake<T>(): (
|
|
833
|
+
input: T,
|
|
834
|
+
) => IValidation<SnakeCase<T>>;
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* @internal
|
|
838
|
+
*/
|
|
839
|
+
export function createValidateSnake(): never {
|
|
840
|
+
halt("createValidateSnake");
|
|
841
|
+
}
|
|
842
|
+
Object.assign(
|
|
843
|
+
createValidateSnake,
|
|
844
|
+
Namespace.notations.snake("createValidateSnake"),
|
|
845
|
+
);
|
|
846
|
+
Object.assign(createValidateSnake, Namespace.validate());
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* @internal
|
|
850
|
+
*/
|
|
851
|
+
function halt(name: string): never {
|
|
852
|
+
throw new Error(
|
|
853
|
+
`Error on typia.notations.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
|
|
854
|
+
);
|
|
855
|
+
}
|