typia 6.6.0-dev.20240720 → 6.6.0-dev.20240727
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/CamelCase.d.ts +3 -2
- package/lib/PascalCase.d.ts +2 -2
- package/lib/factories/internal/metadata/iterate_metadata_constant.js +26 -8
- package/lib/factories/internal/metadata/iterate_metadata_constant.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js +15 -10
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.js +2 -1
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/internal/application_description.d.ts +2 -2
- package/lib/programmers/internal/application_description.js +2 -3
- package/lib/programmers/internal/application_description.js.map +1 -1
- package/lib/programmers/internal/application_title.d.ts +5 -0
- package/lib/programmers/internal/application_title.js +17 -0
- package/lib/programmers/internal/application_title.js.map +1 -0
- package/lib/programmers/internal/application_v31_alias.js +2 -8
- package/lib/programmers/internal/application_v31_alias.js.map +1 -1
- package/lib/programmers/internal/application_v31_constant.js +4 -0
- package/lib/programmers/internal/application_v31_constant.js.map +1 -1
- package/lib/programmers/internal/application_v31_object.js +31 -47
- package/lib/programmers/internal/application_v31_object.js.map +1 -1
- package/lib/programmers/internal/postfix_of_tuple.d.ts +1 -0
- package/lib/programmers/internal/postfix_of_tuple.js +8 -0
- package/lib/programmers/internal/postfix_of_tuple.js.map +1 -0
- package/lib/programmers/json/JsonStringifyProgrammer.js +2 -1
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js +2 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js +2 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js +2 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
- package/lib/schemas/metadata/IMetadataConstantValue.d.ts +3 -0
- package/lib/schemas/metadata/MetadataConstantValue.d.ts +3 -0
- package/lib/schemas/metadata/MetadataConstantValue.js +2 -0
- package/lib/schemas/metadata/MetadataConstantValue.js.map +1 -1
- package/lib/utils/NamingConvention/NamingConvention.d.ts +2 -2
- package/lib/utils/NamingConvention/NamingConvention.js +53 -72
- package/lib/utils/NamingConvention/NamingConvention.js.map +1 -1
- package/lib/utils/NamingConvention/NamingConvention.mjs +42 -56
- package/lib/utils/NamingConvention/NamingConvention.mjs.map +1 -1
- package/lib/utils/StringUtil/StringUtil.js +1 -1
- package/lib/utils/StringUtil/StringUtil.js.map +1 -1
- package/lib/utils/StringUtil/StringUtil.mjs +1 -1
- package/lib/utils/StringUtil/StringUtil.mjs.map +1 -1
- package/package.json +1 -1
- package/src/CamelCase.ts +14 -7
- package/src/PascalCase.ts +10 -7
- package/src/factories/internal/metadata/iterate_metadata_constant.ts +13 -0
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +14 -10
- package/src/programmers/CheckerProgrammer.ts +2 -1
- package/src/programmers/internal/application_description.ts +3 -3
- package/src/programmers/internal/application_title.ts +20 -0
- package/src/programmers/internal/application_v31_alias.ts +2 -11
- package/src/programmers/internal/application_v31_constant.ts +4 -0
- package/src/programmers/internal/application_v31_object.ts +2 -17
- package/src/programmers/internal/postfix_of_tuple.ts +2 -0
- package/src/programmers/json/JsonStringifyProgrammer.ts +2 -1
- package/src/programmers/misc/MiscCloneProgrammer.ts +2 -1
- package/src/programmers/misc/MiscPruneProgrammer.ts +2 -1
- package/src/programmers/notations/NotationGeneralProgrammer.ts +2 -1
- package/src/schemas/metadata/IMetadataConstantValue.ts +3 -0
- package/src/schemas/metadata/MetadataConstantValue.ts +5 -0
- package/src/utils/NamingConvention/NamingConvention.ts +46 -43
- package/src/utils/StringUtil/StringUtil.ts +1 -1
|
@@ -33,6 +33,7 @@ import { UnionExplorer } from "../helpers/UnionExplorer";
|
|
|
33
33
|
import { check_native } from "../internal/check_native";
|
|
34
34
|
import { decode_union_object } from "../internal/decode_union_object";
|
|
35
35
|
import { feature_object_entries } from "../internal/feature_object_entries";
|
|
36
|
+
import { postfix_of_tuple } from "../internal/postfix_of_tuple";
|
|
36
37
|
import { wrap_metadata_rest_tuple } from "../internal/wrap_metadata_rest_tuple";
|
|
37
38
|
|
|
38
39
|
export namespace JsonStringifyProgrammer {
|
|
@@ -543,7 +544,7 @@ export namespace JsonStringifyProgrammer {
|
|
|
543
544
|
...explore,
|
|
544
545
|
from: "array",
|
|
545
546
|
postfix: explore.postfix.length
|
|
546
|
-
? `${explore.postfix
|
|
547
|
+
? `${postfix_of_tuple(explore.postfix)}[${index}]"`
|
|
547
548
|
: `"[${index}]"`,
|
|
548
549
|
},
|
|
549
550
|
),
|
|
@@ -21,6 +21,7 @@ import { CloneJoiner } from "../helpers/CloneJoiner";
|
|
|
21
21
|
import { FunctionImporter } from "../helpers/FunctionImporter";
|
|
22
22
|
import { UnionExplorer } from "../helpers/UnionExplorer";
|
|
23
23
|
import { decode_union_object } from "../internal/decode_union_object";
|
|
24
|
+
import { postfix_of_tuple } from "../internal/postfix_of_tuple";
|
|
24
25
|
import { wrap_metadata_rest_tuple } from "../internal/wrap_metadata_rest_tuple";
|
|
25
26
|
|
|
26
27
|
export namespace MiscCloneProgrammer {
|
|
@@ -335,7 +336,7 @@ export namespace MiscCloneProgrammer {
|
|
|
335
336
|
...explore,
|
|
336
337
|
from: "array",
|
|
337
338
|
postfix: explore.postfix.length
|
|
338
|
-
? `${explore.postfix
|
|
339
|
+
? `${postfix_of_tuple(explore.postfix)}[${index}]"`
|
|
339
340
|
: `"[${index}]"`,
|
|
340
341
|
},
|
|
341
342
|
),
|
|
@@ -21,6 +21,7 @@ import { FunctionImporter } from "../helpers/FunctionImporter";
|
|
|
21
21
|
import { PruneJoiner } from "../helpers/PruneJoiner";
|
|
22
22
|
import { UnionExplorer } from "../helpers/UnionExplorer";
|
|
23
23
|
import { decode_union_object } from "../internal/decode_union_object";
|
|
24
|
+
import { postfix_of_tuple } from "../internal/postfix_of_tuple";
|
|
24
25
|
import { wrap_metadata_rest_tuple } from "../internal/wrap_metadata_rest_tuple";
|
|
25
26
|
|
|
26
27
|
export namespace MiscPruneProgrammer {
|
|
@@ -302,7 +303,7 @@ export namespace MiscPruneProgrammer {
|
|
|
302
303
|
...explore,
|
|
303
304
|
from: "array",
|
|
304
305
|
postfix: explore.postfix.length
|
|
305
|
-
? `${explore.postfix
|
|
306
|
+
? `${postfix_of_tuple(explore.postfix)}[${index}]"`
|
|
306
307
|
: `"[${index}]"`,
|
|
307
308
|
},
|
|
308
309
|
),
|
|
@@ -23,6 +23,7 @@ import { FunctionImporter } from "../helpers/FunctionImporter";
|
|
|
23
23
|
import { NotationJoiner } from "../helpers/NotationJoiner";
|
|
24
24
|
import { UnionExplorer } from "../helpers/UnionExplorer";
|
|
25
25
|
import { decode_union_object } from "../internal/decode_union_object";
|
|
26
|
+
import { postfix_of_tuple } from "../internal/postfix_of_tuple";
|
|
26
27
|
import { wrap_metadata_rest_tuple } from "../internal/wrap_metadata_rest_tuple";
|
|
27
28
|
|
|
28
29
|
export namespace NotationGeneralProgrammer {
|
|
@@ -345,7 +346,7 @@ export namespace NotationGeneralProgrammer {
|
|
|
345
346
|
...explore,
|
|
346
347
|
from: "array",
|
|
347
348
|
postfix: explore.postfix.length
|
|
348
|
-
? `${explore.postfix
|
|
349
|
+
? `${postfix_of_tuple(explore.postfix)}[${index}]"`
|
|
349
350
|
: `"[${index}]"`,
|
|
350
351
|
},
|
|
351
352
|
),
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Atomic } from "../../typings/Atomic";
|
|
2
2
|
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
3
4
|
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
4
5
|
|
|
5
6
|
export interface IMetadataConstantValue<T extends Atomic.Type> {
|
|
6
7
|
value: T;
|
|
7
8
|
tags: IMetadataTypeTag[][] | undefined;
|
|
9
|
+
description?: string | null;
|
|
10
|
+
jsDocTags?: IJsDocTagInfo[];
|
|
8
11
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
2
|
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
3
4
|
import { IMetadataConstantValue } from "./IMetadataConstantValue";
|
|
4
5
|
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
6
|
|
|
6
7
|
export class MetadataConstantValue {
|
|
7
8
|
public readonly value: boolean | bigint | number | string;
|
|
8
9
|
public tags: IMetadataTypeTag[][] | undefined;
|
|
10
|
+
public readonly description?: string | null;
|
|
11
|
+
public readonly jsDocTags?: IJsDocTagInfo[];
|
|
9
12
|
private name_?: string;
|
|
10
13
|
|
|
11
14
|
private constructor(props: ClassProperties<MetadataConstantValue>) {
|
|
12
15
|
this.value = props.value;
|
|
13
16
|
this.tags = props.tags;
|
|
17
|
+
this.description = props.description;
|
|
18
|
+
this.jsDocTags = props.jsDocTags;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
public static create(
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { StringUtil } from "../StringUtil";
|
|
2
2
|
|
|
3
3
|
export function snake(str: string): string {
|
|
4
|
+
if (str.length === 0) return str;
|
|
5
|
+
|
|
6
|
+
// PREFIX
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
let prefix: string = "";
|
|
9
|
+
for (let i: number = 0; i < str.length; i++) {
|
|
10
|
+
if (str[i] === "_") prefix += "_";
|
|
11
|
+
else break;
|
|
12
|
+
}
|
|
13
|
+
if (prefix.length !== 0) str = str.substring(prefix.length);
|
|
14
|
+
|
|
15
|
+
const out = (s: string) => `${prefix}${s}`;
|
|
16
|
+
|
|
17
|
+
// SNAKE CASE
|
|
18
|
+
const items: string[] = str.split("_");
|
|
19
|
+
if (items.length > 1) return out(items.map((s) => s.toLowerCase()).join("_"));
|
|
20
|
+
|
|
21
|
+
// CAMEL OR PASCAL CASE
|
|
4
22
|
const indexes: number[] = [];
|
|
5
23
|
for (let i: number = 0; i < str.length; i++) {
|
|
6
24
|
const code: number = str.charCodeAt(i);
|
|
@@ -23,29 +41,33 @@ export function snake(str: string): string {
|
|
|
23
41
|
ret += "_";
|
|
24
42
|
}
|
|
25
43
|
ret += str.substring(indexes[indexes.length - 1]!).toLowerCase();
|
|
26
|
-
return ret;
|
|
44
|
+
return out(ret);
|
|
27
45
|
}
|
|
28
46
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
export const camel = (str: string): string =>
|
|
48
|
+
unsnake({
|
|
49
|
+
plain: (str) =>
|
|
50
|
+
str.length
|
|
51
|
+
? str === str.toUpperCase()
|
|
52
|
+
? str.toLocaleLowerCase()
|
|
53
|
+
: `${str[0]!.toLowerCase()}${str.substring(1)}`
|
|
54
|
+
: str,
|
|
55
|
+
snake: (str, i) =>
|
|
56
|
+
i === 0 ? str.toLowerCase() : StringUtil.capitalize(str.toLowerCase()),
|
|
35
57
|
})(str);
|
|
36
|
-
}
|
|
37
58
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
else return str;
|
|
59
|
+
export const pascal = (str: string): string =>
|
|
60
|
+
unsnake({
|
|
61
|
+
plain: (str) =>
|
|
62
|
+
str.length ? `${str[0]!.toUpperCase()}${str.substring(1)}` : str,
|
|
63
|
+
snake: StringUtil.capitalize,
|
|
44
64
|
})(str);
|
|
45
|
-
}
|
|
46
65
|
|
|
47
66
|
const unsnake =
|
|
48
|
-
(
|
|
67
|
+
(props: {
|
|
68
|
+
plain: (str: string) => string;
|
|
69
|
+
snake: (str: string, index: number) => string;
|
|
70
|
+
}) =>
|
|
49
71
|
(str: string): string => {
|
|
50
72
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
73
|
let prefix: string = "";
|
|
@@ -55,32 +77,13 @@ const unsnake =
|
|
|
55
77
|
}
|
|
56
78
|
if (prefix.length !== 0) str = str.substring(prefix.length);
|
|
57
79
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const ch: string = str[i]!;
|
|
61
|
-
if (ch !== "_") continue;
|
|
62
|
-
|
|
63
|
-
const last = indexes[indexes.length - 1];
|
|
64
|
-
if (last === undefined || last[0] + last[1] !== i) indexes.push([i, 1]);
|
|
65
|
-
else ++last[1];
|
|
66
|
-
}
|
|
67
|
-
if (indexes.length === 0) return prefix + escaper(str);
|
|
80
|
+
const out = (s: string) => `${prefix}${s}`;
|
|
81
|
+
if (str.length === 0) return out("");
|
|
68
82
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
else ret += str.substring(0, first);
|
|
76
|
-
else {
|
|
77
|
-
const [prevFirst, prevLength] = indexes[i - 1]!;
|
|
78
|
-
const piece: string = str.substring(prevFirst + prevLength, first);
|
|
79
|
-
if (piece.length) ret += StringUtil.capitalize(piece);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const last = indexes[indexes.length - 1]!;
|
|
83
|
-
const piece: string = str.substring(last[0] + last[1]);
|
|
84
|
-
if (last.length) ret += StringUtil.capitalize(piece);
|
|
85
|
-
return prefix + escaper(ret);
|
|
83
|
+
const items: string[] = str.split("_").filter((s) => s.length !== 0);
|
|
84
|
+
return items.length === 0
|
|
85
|
+
? out("")
|
|
86
|
+
: items.length === 1
|
|
87
|
+
? out(props.plain(items[0]!))
|
|
88
|
+
: out(items.map(props.snake).join(""));
|
|
86
89
|
};
|