typia 12.0.0-dev.20260307-2 → 12.0.0-dev.20260310

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.
Files changed (155) hide show
  1. package/lib/executable/setup/PluginConfigurator.js +3 -3
  2. package/lib/executable/setup/PluginConfigurator.mjs +3 -3
  3. package/lib/executable/setup/PluginConfigurator.mjs.map +1 -1
  4. package/lib/executable/typia.js +15 -15
  5. package/lib/executable/typia.mjs +15 -15
  6. package/lib/internal/_coerceLlmArguments.d.ts +2 -0
  7. package/lib/internal/_coerceLlmArguments.js +7 -0
  8. package/lib/internal/_coerceLlmArguments.js.map +1 -0
  9. package/lib/internal/_coerceLlmArguments.mjs +6 -0
  10. package/lib/internal/_coerceLlmArguments.mjs.map +1 -0
  11. package/lib/internal/_llmApplicationFinalize.js +1 -1
  12. package/lib/internal/_llmApplicationFinalize.js.map +1 -1
  13. package/lib/internal/_llmApplicationFinalize.mjs +1 -0
  14. package/lib/internal/_llmApplicationFinalize.mjs.map +1 -1
  15. package/lib/internal/_parseLlmArguments.d.ts +2 -0
  16. package/lib/internal/_parseLlmArguments.js +7 -0
  17. package/lib/internal/_parseLlmArguments.js.map +1 -0
  18. package/lib/internal/_parseLlmArguments.mjs +6 -0
  19. package/lib/internal/_parseLlmArguments.mjs.map +1 -0
  20. package/lib/llm.d.ts +154 -1
  21. package/lib/llm.js +20 -0
  22. package/lib/llm.js.map +1 -1
  23. package/lib/llm.mjs +17 -1
  24. package/lib/llm.mjs.map +1 -1
  25. package/lib/re-exports.d.ts +1 -1
  26. package/lib/re-exports.js.map +1 -1
  27. package/package.json +5 -5
  28. package/src/TypeGuardError.ts +145 -145
  29. package/src/executable/TypiaGenerateWizard.ts +82 -82
  30. package/src/executable/TypiaPatchWizard.ts +45 -45
  31. package/src/executable/TypiaSetupWizard.ts +171 -171
  32. package/src/executable/setup/ArgumentParser.ts +42 -42
  33. package/src/executable/setup/CommandExecutor.ts +8 -8
  34. package/src/executable/setup/FileRetriever.ts +19 -19
  35. package/src/executable/setup/PackageManager.ts +87 -87
  36. package/src/executable/setup/PluginConfigurator.ts +74 -74
  37. package/src/executable/typia.ts +55 -55
  38. package/src/functional.ts +600 -600
  39. package/src/http.ts +843 -843
  40. package/src/index.ts +4 -4
  41. package/src/internal/_IProtobufWriter.ts +18 -18
  42. package/src/internal/_ProtobufReader.ts +187 -187
  43. package/src/internal/_ProtobufSizer.ts +137 -137
  44. package/src/internal/_ProtobufWriter.ts +135 -135
  45. package/src/internal/_accessExpressionAsString.ts +46 -46
  46. package/src/internal/_assertGuard.ts +13 -13
  47. package/src/internal/_coerceLlmArguments.ts +7 -0
  48. package/src/internal/_createStandardSchema.ts +133 -133
  49. package/src/internal/_functionalTypeGuardErrorFactory.ts +4 -4
  50. package/src/internal/_httpFormDataReadArray.ts +4 -4
  51. package/src/internal/_httpFormDataReadBigint.ts +18 -18
  52. package/src/internal/_httpFormDataReadBlob.ts +10 -10
  53. package/src/internal/_httpFormDataReadBoolean.ts +16 -16
  54. package/src/internal/_httpFormDataReadFile.ts +10 -10
  55. package/src/internal/_httpFormDataReadNumber.ts +15 -15
  56. package/src/internal/_httpFormDataReadString.ts +10 -10
  57. package/src/internal/_httpHeaderReadBigint.ts +10 -10
  58. package/src/internal/_httpHeaderReadBoolean.ts +8 -8
  59. package/src/internal/_httpHeaderReadNumber.ts +7 -7
  60. package/src/internal/_httpParameterReadBigint.ts +10 -10
  61. package/src/internal/_httpParameterReadBoolean.ts +8 -8
  62. package/src/internal/_httpParameterReadNumber.ts +7 -7
  63. package/src/internal/_httpParameterReadString.ts +2 -2
  64. package/src/internal/_httpQueryParseURLSearchParams.ts +12 -12
  65. package/src/internal/_httpQueryReadArray.ts +4 -4
  66. package/src/internal/_httpQueryReadBigint.ts +12 -12
  67. package/src/internal/_httpQueryReadBoolean.ts +14 -14
  68. package/src/internal/_httpQueryReadNumber.ts +9 -9
  69. package/src/internal/_httpQueryReadString.ts +4 -4
  70. package/src/internal/_isBetween.ts +2 -2
  71. package/src/internal/_isBigintString.ts +8 -8
  72. package/src/internal/_isFormatByte.ts +7 -7
  73. package/src/internal/_isFormatDate.ts +3 -3
  74. package/src/internal/_isFormatDateTime.ts +4 -4
  75. package/src/internal/_isFormatDuration.ts +4 -4
  76. package/src/internal/_isFormatEmail.ts +4 -4
  77. package/src/internal/_isFormatHostname.ts +4 -4
  78. package/src/internal/_isFormatIdnEmail.ts +4 -4
  79. package/src/internal/_isFormatIdnHostname.ts +4 -4
  80. package/src/internal/_isFormatIpv4.ts +4 -4
  81. package/src/internal/_isFormatIpv6.ts +4 -4
  82. package/src/internal/_isFormatIri.ts +3 -3
  83. package/src/internal/_isFormatIriReference.ts +4 -4
  84. package/src/internal/_isFormatJsonPointer.ts +3 -3
  85. package/src/internal/_isFormatPassword.ts +1 -1
  86. package/src/internal/_isFormatRegex.ts +8 -8
  87. package/src/internal/_isFormatRelativeJsonPointer.ts +4 -4
  88. package/src/internal/_isFormatTime.ts +4 -4
  89. package/src/internal/_isFormatUri.ts +6 -6
  90. package/src/internal/_isFormatUriReference.ts +5 -5
  91. package/src/internal/_isFormatUriTemplate.ts +4 -4
  92. package/src/internal/_isFormatUrl.ts +4 -4
  93. package/src/internal/_isFormatUuid.ts +3 -3
  94. package/src/internal/_isTypeFloat.ts +5 -5
  95. package/src/internal/_isTypeInt32.ts +5 -5
  96. package/src/internal/_isTypeInt64.ts +5 -5
  97. package/src/internal/_isTypeUint32.ts +5 -5
  98. package/src/internal/_isTypeUint64.ts +5 -5
  99. package/src/internal/_isUniqueItems.ts +159 -159
  100. package/src/internal/_jsonStringifyNumber.ts +12 -12
  101. package/src/internal/_jsonStringifyRest.ts +3 -3
  102. package/src/internal/_jsonStringifyString.ts +42 -42
  103. package/src/internal/_jsonStringifyTail.ts +2 -2
  104. package/src/internal/_llmApplicationFinalize.ts +24 -23
  105. package/src/internal/_miscCloneAny.ts +46 -46
  106. package/src/internal/_notationAny.ts +37 -37
  107. package/src/internal/_notationCamel.ts +13 -13
  108. package/src/internal/_notationPascal.ts +8 -8
  109. package/src/internal/_notationSnake.ts +43 -43
  110. package/src/internal/_parseLlmArguments.ts +7 -0
  111. package/src/internal/_randomArray.ts +21 -21
  112. package/src/internal/_randomBigint.ts +6 -6
  113. package/src/internal/_randomBoolean.ts +1 -1
  114. package/src/internal/_randomFormatByte.ts +3 -3
  115. package/src/internal/_randomFormatDate.ts +18 -18
  116. package/src/internal/_randomFormatDatetime.ts +16 -16
  117. package/src/internal/_randomFormatDuration.ts +27 -27
  118. package/src/internal/_randomFormatEmail.ts +11 -11
  119. package/src/internal/_randomFormatHostname.ts +6 -6
  120. package/src/internal/_randomFormatIdnEmail.ts +3 -3
  121. package/src/internal/_randomFormatIdnHostname.ts +3 -3
  122. package/src/internal/_randomFormatIpv4.ts +11 -11
  123. package/src/internal/_randomFormatIpv6.ts +11 -11
  124. package/src/internal/_randomFormatIri.ts +3 -3
  125. package/src/internal/_randomFormatIriReference.ts +3 -3
  126. package/src/internal/_randomFormatJsonPointer.ts +7 -7
  127. package/src/internal/_randomFormatPassword.ts +8 -8
  128. package/src/internal/_randomFormatRegex.ts +4 -4
  129. package/src/internal/_randomFormatRelativeJsonPointer.ts +8 -8
  130. package/src/internal/_randomFormatTime.ts +14 -14
  131. package/src/internal/_randomFormatUri.ts +3 -3
  132. package/src/internal/_randomFormatUriReference.ts +3 -3
  133. package/src/internal/_randomFormatUriTemplate.ts +3 -3
  134. package/src/internal/_randomFormatUrl.ts +11 -11
  135. package/src/internal/_randomFormatUuid.ts +6 -6
  136. package/src/internal/_randomInteger.ts +53 -53
  137. package/src/internal/_randomNumber.ts +80 -80
  138. package/src/internal/_randomPattern.ts +10 -10
  139. package/src/internal/_randomPick.ts +9 -9
  140. package/src/internal/_randomString.ts +24 -24
  141. package/src/internal/_throwTypeGuardError.ts +5 -5
  142. package/src/internal/_validateReport.ts +21 -21
  143. package/src/internal/private/__notationCapitalize.ts +2 -2
  144. package/src/internal/private/__notationUnsnake.ts +24 -24
  145. package/src/json.ts +553 -553
  146. package/src/llm.ts +408 -211
  147. package/src/misc.ts +448 -448
  148. package/src/module.ts +811 -811
  149. package/src/notations.ts +624 -624
  150. package/src/programmers/TypiaProgrammer.ts +8 -8
  151. package/src/protobuf.ts +499 -499
  152. package/src/re-exports.ts +33 -32
  153. package/src/reflect.ts +75 -75
  154. package/src/transform.ts +5 -5
  155. package/src/transformers/NoTransformConfigurationError.ts +16 -16
@@ -1,133 +1,133 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
2
- import { IValidation } from "@typia/interface";
3
-
4
- export const _createStandardSchema = <T>(
5
- fn: (input: unknown) => IValidation<T>,
6
- ): ((input: unknown) => IValidation<T>) & StandardSchemaV1<T, T> =>
7
- Object.assign(fn, {
8
- "~standard": {
9
- version: 1,
10
- vendor: "typia",
11
- validate: (input: unknown): StandardSchemaV1.Result<T> => {
12
- const result = fn(input);
13
- if (result.success) {
14
- return {
15
- value: result.data,
16
- } satisfies StandardSchemaV1.SuccessResult<T>;
17
- } else {
18
- return {
19
- issues: result.errors.map((error) => ({
20
- message: `expected ${error.expected}, got ${error.value}`,
21
- path: typiaPathToStandardSchemaPath(error.path),
22
- })),
23
- } satisfies StandardSchemaV1.FailureResult;
24
- }
25
- },
26
- },
27
- } satisfies StandardSchemaV1<T, T>);
28
-
29
- enum PathParserState {
30
- // Start of a new segment
31
- // When the parser is in this state,
32
- // the pointer must point `.` or `[` or equal to length of the path
33
- Start,
34
- // Parsing a property key (`.hoge`)
35
- Property,
36
- // Parsing a string key (`["fuga"]`)
37
- StringKey,
38
- // Parsing a number key (`[42]`)
39
- NumberKey,
40
- }
41
-
42
- const typiaPathToStandardSchemaPath = (
43
- path: string,
44
- ): ReadonlyArray<StandardSchemaV1.PathSegment> => {
45
- if (!path.startsWith("$input")) {
46
- throw new Error(`Invalid path: ${JSON.stringify(path)}`);
47
- }
48
-
49
- const segments: StandardSchemaV1.PathSegment[] = [];
50
- let currentSegment = "";
51
- let state: PathParserState = PathParserState.Start;
52
- let index = "$input".length - 1;
53
- while (index < path.length - 1) {
54
- index++;
55
- const char = path[index];
56
-
57
- if (state === PathParserState.Property) {
58
- if (char === "." || char === "[") {
59
- // End of property
60
- segments.push({
61
- key: currentSegment,
62
- });
63
- state = PathParserState.Start;
64
- } else if (index === path.length - 1) {
65
- // End of path
66
- currentSegment += char;
67
- segments.push({
68
- key: currentSegment,
69
- });
70
- index++;
71
- state = PathParserState.Start;
72
- } else {
73
- currentSegment += char;
74
- }
75
- } else if (state === PathParserState.StringKey) {
76
- if (char === '"') {
77
- // End of string key
78
- segments.push({
79
- key: JSON.parse(currentSegment + char),
80
- });
81
- // Skip `"` and `]`
82
- index += 2;
83
- state = PathParserState.Start;
84
- } else if (char === "\\") {
85
- // Skip the next character from parsing
86
- currentSegment += path[index];
87
- index++;
88
- currentSegment += path[index];
89
- } else {
90
- currentSegment += char;
91
- }
92
- } else if (state === PathParserState.NumberKey) {
93
- if (char === "]") {
94
- // End of number key
95
- segments.push({
96
- key: Number.parseInt(currentSegment),
97
- });
98
- index++;
99
- state = PathParserState.Start;
100
- } else {
101
- currentSegment += char;
102
- }
103
- }
104
-
105
- if (state === PathParserState.Start && index < path.length - 1) {
106
- const newChar = path[index];
107
- currentSegment = "";
108
- if (newChar === "[") {
109
- if (path[index + 1] === '"') {
110
- // Start of string key
111
- // NOTE: Typia uses JSON.stringify for this kind of keys, so `'` will not used as a string delimiter
112
- state = PathParserState.StringKey;
113
- index++;
114
- currentSegment = '"';
115
- } else {
116
- // Start of number key
117
- state = PathParserState.NumberKey;
118
- }
119
- } else if (newChar === ".") {
120
- // Start of property
121
- state = PathParserState.Property;
122
- } else {
123
- throw new Error("Unreachable: pointer points invalid character");
124
- }
125
- }
126
- }
127
-
128
- if (state !== PathParserState.Start) {
129
- throw new Error(`Failed to parse path: ${JSON.stringify(path)}`);
130
- }
131
-
132
- return segments;
133
- };
1
+ import { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import { IValidation } from "@typia/interface";
3
+
4
+ export const _createStandardSchema = <T>(
5
+ fn: (input: unknown) => IValidation<T>,
6
+ ): ((input: unknown) => IValidation<T>) & StandardSchemaV1<T, T> =>
7
+ Object.assign(fn, {
8
+ "~standard": {
9
+ version: 1,
10
+ vendor: "typia",
11
+ validate: (input: unknown): StandardSchemaV1.Result<T> => {
12
+ const result = fn(input);
13
+ if (result.success) {
14
+ return {
15
+ value: result.data,
16
+ } satisfies StandardSchemaV1.SuccessResult<T>;
17
+ } else {
18
+ return {
19
+ issues: result.errors.map((error) => ({
20
+ message: `expected ${error.expected}, got ${error.value}`,
21
+ path: typiaPathToStandardSchemaPath(error.path),
22
+ })),
23
+ } satisfies StandardSchemaV1.FailureResult;
24
+ }
25
+ },
26
+ },
27
+ } satisfies StandardSchemaV1<T, T>);
28
+
29
+ enum PathParserState {
30
+ // Start of a new segment
31
+ // When the parser is in this state,
32
+ // the pointer must point `.` or `[` or equal to length of the path
33
+ Start,
34
+ // Parsing a property key (`.hoge`)
35
+ Property,
36
+ // Parsing a string key (`["fuga"]`)
37
+ StringKey,
38
+ // Parsing a number key (`[42]`)
39
+ NumberKey,
40
+ }
41
+
42
+ const typiaPathToStandardSchemaPath = (
43
+ path: string,
44
+ ): ReadonlyArray<StandardSchemaV1.PathSegment> => {
45
+ if (!path.startsWith("$input")) {
46
+ throw new Error(`Invalid path: ${JSON.stringify(path)}`);
47
+ }
48
+
49
+ const segments: StandardSchemaV1.PathSegment[] = [];
50
+ let currentSegment = "";
51
+ let state: PathParserState = PathParserState.Start;
52
+ let index = "$input".length - 1;
53
+ while (index < path.length - 1) {
54
+ index++;
55
+ const char = path[index];
56
+
57
+ if (state === PathParserState.Property) {
58
+ if (char === "." || char === "[") {
59
+ // End of property
60
+ segments.push({
61
+ key: currentSegment,
62
+ });
63
+ state = PathParserState.Start;
64
+ } else if (index === path.length - 1) {
65
+ // End of path
66
+ currentSegment += char;
67
+ segments.push({
68
+ key: currentSegment,
69
+ });
70
+ index++;
71
+ state = PathParserState.Start;
72
+ } else {
73
+ currentSegment += char;
74
+ }
75
+ } else if (state === PathParserState.StringKey) {
76
+ if (char === '"') {
77
+ // End of string key
78
+ segments.push({
79
+ key: JSON.parse(currentSegment + char),
80
+ });
81
+ // Skip `"` and `]`
82
+ index += 2;
83
+ state = PathParserState.Start;
84
+ } else if (char === "\\") {
85
+ // Skip the next character from parsing
86
+ currentSegment += path[index];
87
+ index++;
88
+ currentSegment += path[index];
89
+ } else {
90
+ currentSegment += char;
91
+ }
92
+ } else if (state === PathParserState.NumberKey) {
93
+ if (char === "]") {
94
+ // End of number key
95
+ segments.push({
96
+ key: Number.parseInt(currentSegment),
97
+ });
98
+ index++;
99
+ state = PathParserState.Start;
100
+ } else {
101
+ currentSegment += char;
102
+ }
103
+ }
104
+
105
+ if (state === PathParserState.Start && index < path.length - 1) {
106
+ const newChar = path[index];
107
+ currentSegment = "";
108
+ if (newChar === "[") {
109
+ if (path[index + 1] === '"') {
110
+ // Start of string key
111
+ // NOTE: Typia uses JSON.stringify for this kind of keys, so `'` will not used as a string delimiter
112
+ state = PathParserState.StringKey;
113
+ index++;
114
+ currentSegment = '"';
115
+ } else {
116
+ // Start of number key
117
+ state = PathParserState.NumberKey;
118
+ }
119
+ } else if (newChar === ".") {
120
+ // Start of property
121
+ state = PathParserState.Property;
122
+ } else {
123
+ throw new Error("Unreachable: pointer points invalid character");
124
+ }
125
+ }
126
+ }
127
+
128
+ if (state !== PathParserState.Start) {
129
+ throw new Error(`Failed to parse path: ${JSON.stringify(path)}`);
130
+ }
131
+
132
+ return segments;
133
+ };
@@ -1,4 +1,4 @@
1
- import { TypeGuardError } from "../TypeGuardError";
2
-
3
- export const _functionalTypeGuardErrorFactory = (p: TypeGuardError.IProps) =>
4
- new TypeGuardError(p);
1
+ import { TypeGuardError } from "../TypeGuardError";
2
+
3
+ export const _functionalTypeGuardErrorFactory = (p: TypeGuardError.IProps) =>
4
+ new TypeGuardError(p);
@@ -1,4 +1,4 @@
1
- export const _httpFormDataReadArray = (
2
- input: any[],
3
- alternative: null | undefined,
4
- ) => (input.length ? input : alternative);
1
+ export const _httpFormDataReadArray = (
2
+ input: any[],
3
+ alternative: null | undefined,
4
+ ) => (input.length ? input : alternative);
@@ -1,18 +1,18 @@
1
- export const _httpFormDataReadBigint = (
2
- input: string | File | null,
3
- ): bigint | null | undefined =>
4
- input instanceof File
5
- ? (input as any)
6
- : !!input?.length
7
- ? input === "null"
8
- ? null
9
- : (toBigint(input) as any)
10
- : undefined;
11
-
12
- const toBigint = (str: string): bigint | string => {
13
- try {
14
- return BigInt(str);
15
- } catch {
16
- return str;
17
- }
18
- };
1
+ export const _httpFormDataReadBigint = (
2
+ input: string | File | null,
3
+ ): bigint | null | undefined =>
4
+ input instanceof File
5
+ ? (input as any)
6
+ : !!input?.length
7
+ ? input === "null"
8
+ ? null
9
+ : (toBigint(input) as any)
10
+ : undefined;
11
+
12
+ const toBigint = (str: string): bigint | string => {
13
+ try {
14
+ return BigInt(str);
15
+ } catch {
16
+ return str;
17
+ }
18
+ };
@@ -1,10 +1,10 @@
1
- export const _httpFormDataReadBlob = (
2
- input: string | Blob | null,
3
- ): Blob | null | undefined =>
4
- input instanceof Blob
5
- ? input
6
- : input === null
7
- ? undefined
8
- : input === "null"
9
- ? null
10
- : (input as any);
1
+ export const _httpFormDataReadBlob = (
2
+ input: string | Blob | null,
3
+ ): Blob | null | undefined =>
4
+ input instanceof Blob
5
+ ? input
6
+ : input === null
7
+ ? undefined
8
+ : input === "null"
9
+ ? null
10
+ : (input as any);
@@ -1,16 +1,16 @@
1
- export const _httpFormDataReadBoolean = (
2
- input: string | File | null,
3
- ): boolean | null | undefined =>
4
- input instanceof File
5
- ? (input as any)
6
- : input === null
7
- ? undefined
8
- : input === "null"
9
- ? null
10
- : input.length === 0
11
- ? true
12
- : input === "true" || input === "1"
13
- ? true
14
- : input === "false" || input === "0"
15
- ? false
16
- : (input as any); // wrong type
1
+ export const _httpFormDataReadBoolean = (
2
+ input: string | File | null,
3
+ ): boolean | null | undefined =>
4
+ input instanceof File
5
+ ? (input as any)
6
+ : input === null
7
+ ? undefined
8
+ : input === "null"
9
+ ? null
10
+ : input.length === 0
11
+ ? true
12
+ : input === "true" || input === "1"
13
+ ? true
14
+ : input === "false" || input === "0"
15
+ ? false
16
+ : (input as any); // wrong type
@@ -1,10 +1,10 @@
1
- export const _httpFormDataReadFile = (
2
- input: string | File | null,
3
- ): File | null | undefined =>
4
- input instanceof File
5
- ? input
6
- : input === null
7
- ? undefined
8
- : input === "null"
9
- ? null
10
- : (input as any);
1
+ export const _httpFormDataReadFile = (
2
+ input: string | File | null,
3
+ ): File | null | undefined =>
4
+ input instanceof File
5
+ ? input
6
+ : input === null
7
+ ? undefined
8
+ : input === "null"
9
+ ? null
10
+ : (input as any);
@@ -1,15 +1,15 @@
1
- export const _httpFormDataReadNumber = (
2
- input: string | File | null,
3
- ): number | null | undefined =>
4
- input instanceof File
5
- ? (input as any)
6
- : !!input?.length
7
- ? input === "null"
8
- ? null
9
- : (toNumber(input) as any)
10
- : undefined;
11
-
12
- const toNumber = (str: string): number | string => {
13
- const value: number = Number(str);
14
- return isNaN(value) ? str : value;
15
- };
1
+ export const _httpFormDataReadNumber = (
2
+ input: string | File | null,
3
+ ): number | null | undefined =>
4
+ input instanceof File
5
+ ? (input as any)
6
+ : !!input?.length
7
+ ? input === "null"
8
+ ? null
9
+ : (toNumber(input) as any)
10
+ : undefined;
11
+
12
+ const toNumber = (str: string): number | string => {
13
+ const value: number = Number(str);
14
+ return isNaN(value) ? str : value;
15
+ };
@@ -1,10 +1,10 @@
1
- export const _httpFormDataReadString = (
2
- input: string | File | null,
3
- ): string | null | undefined =>
4
- input instanceof File
5
- ? (input as any)
6
- : input === null
7
- ? undefined
8
- : input === "null"
9
- ? null
10
- : input;
1
+ export const _httpFormDataReadString = (
2
+ input: string | File | null,
3
+ ): string | null | undefined =>
4
+ input instanceof File
5
+ ? (input as any)
6
+ : input === null
7
+ ? undefined
8
+ : input === "null"
9
+ ? null
10
+ : input;
@@ -1,10 +1,10 @@
1
- export const _httpHeaderReadBigint = (value: string | undefined) =>
2
- value !== undefined ? toBigint(value) : undefined;
3
-
4
- const toBigint = (str: string): bigint | string => {
5
- try {
6
- return BigInt(str);
7
- } catch {
8
- return str;
9
- }
10
- };
1
+ export const _httpHeaderReadBigint = (value: string | undefined) =>
2
+ value !== undefined ? toBigint(value) : undefined;
3
+
4
+ const toBigint = (str: string): bigint | string => {
5
+ try {
6
+ return BigInt(str);
7
+ } catch {
8
+ return str;
9
+ }
10
+ };
@@ -1,8 +1,8 @@
1
- export const _httpHeaderReadBoolean = (value: string | undefined) =>
2
- value !== undefined
3
- ? value === "true"
4
- ? true
5
- : value === "false"
6
- ? false
7
- : value
8
- : undefined;
1
+ export const _httpHeaderReadBoolean = (value: string | undefined) =>
2
+ value !== undefined
3
+ ? value === "true"
4
+ ? true
5
+ : value === "false"
6
+ ? false
7
+ : value
8
+ : undefined;
@@ -1,7 +1,7 @@
1
- export const _httpHeaderReadNumber = (value: string | undefined) =>
2
- value !== undefined ? toNumber(value) : undefined;
3
-
4
- const toNumber = (str: string): number | string => {
5
- const value: number = Number(str);
6
- return isNaN(value) ? str : value;
7
- };
1
+ export const _httpHeaderReadNumber = (value: string | undefined) =>
2
+ value !== undefined ? toNumber(value) : undefined;
3
+
4
+ const toNumber = (str: string): number | string => {
5
+ const value: number = Number(str);
6
+ return isNaN(value) ? str : value;
7
+ };
@@ -1,10 +1,10 @@
1
- export const _httpParameterReadBigint = (value: string) =>
2
- value !== "null" ? toBigint(value) : null;
3
-
4
- const toBigint = (str: string): bigint | string => {
5
- try {
6
- return BigInt(str);
7
- } catch {
8
- return str;
9
- }
10
- };
1
+ export const _httpParameterReadBigint = (value: string) =>
2
+ value !== "null" ? toBigint(value) : null;
3
+
4
+ const toBigint = (str: string): bigint | string => {
5
+ try {
6
+ return BigInt(str);
7
+ } catch {
8
+ return str;
9
+ }
10
+ };
@@ -1,8 +1,8 @@
1
- export const _httpParameterReadBoolean = (value: string) =>
2
- value !== "null"
3
- ? value === "true" || value === "1"
4
- ? true
5
- : value === "false" || value === "0"
6
- ? false
7
- : value
8
- : null;
1
+ export const _httpParameterReadBoolean = (value: string) =>
2
+ value !== "null"
3
+ ? value === "true" || value === "1"
4
+ ? true
5
+ : value === "false" || value === "0"
6
+ ? false
7
+ : value
8
+ : null;
@@ -1,7 +1,7 @@
1
- export const _httpParameterReadNumber = (value: string) =>
2
- value !== "null" ? toNumber(value) : null;
3
-
4
- const toNumber = (str: string): number | string => {
5
- const value: number = Number(str);
6
- return isNaN(value) ? str : value;
7
- };
1
+ export const _httpParameterReadNumber = (value: string) =>
2
+ value !== "null" ? toNumber(value) : null;
3
+
4
+ const toNumber = (str: string): number | string => {
5
+ const value: number = Number(str);
6
+ return isNaN(value) ? str : value;
7
+ };
@@ -1,2 +1,2 @@
1
- export const _httpParameterReadString = (value: string) =>
2
- value !== "null" ? value : null;
1
+ export const _httpParameterReadString = (value: string) =>
2
+ value !== "null" ? value : null;
@@ -1,12 +1,12 @@
1
- import { IReadableURLSearchParams } from "@typia/interface";
2
-
3
- export const _httpQueryParseURLSearchParams = (
4
- input: string | IReadableURLSearchParams,
5
- ): IReadableURLSearchParams => {
6
- if (typeof input === "string") {
7
- const index: number = input.indexOf("?");
8
- input = index === -1 ? "" : input.substring(index + 1);
9
- return new URLSearchParams(input);
10
- }
11
- return input;
12
- };
1
+ import { IReadableURLSearchParams } from "@typia/interface";
2
+
3
+ export const _httpQueryParseURLSearchParams = (
4
+ input: string | IReadableURLSearchParams,
5
+ ): IReadableURLSearchParams => {
6
+ if (typeof input === "string") {
7
+ const index: number = input.indexOf("?");
8
+ input = index === -1 ? "" : input.substring(index + 1);
9
+ return new URLSearchParams(input);
10
+ }
11
+ return input;
12
+ };
@@ -1,4 +1,4 @@
1
- export const _httpQueryReadArray = (
2
- input: any[],
3
- alternative: null | undefined,
4
- ) => (input.length ? input : alternative);
1
+ export const _httpQueryReadArray = (
2
+ input: any[],
3
+ alternative: null | undefined,
4
+ ) => (input.length ? input : alternative);
@@ -1,12 +1,12 @@
1
- export const _httpQueryReadBigint = (
2
- str: string | null,
3
- ): bigint | null | undefined =>
4
- !!str?.length ? (str === "null" ? null : (toBigint(str) as any)) : undefined;
5
-
6
- const toBigint = (str: string): bigint | string => {
7
- try {
8
- return BigInt(str);
9
- } catch {
10
- return str;
11
- }
12
- };
1
+ export const _httpQueryReadBigint = (
2
+ str: string | null,
3
+ ): bigint | null | undefined =>
4
+ !!str?.length ? (str === "null" ? null : (toBigint(str) as any)) : undefined;
5
+
6
+ const toBigint = (str: string): bigint | string => {
7
+ try {
8
+ return BigInt(str);
9
+ } catch {
10
+ return str;
11
+ }
12
+ };
@@ -1,14 +1,14 @@
1
- export const _httpQueryReadBoolean = (
2
- str: string | null,
3
- ): boolean | null | undefined =>
4
- str === null
5
- ? undefined
6
- : str === "null"
7
- ? null
8
- : str.length === 0
9
- ? true
10
- : str === "true" || str === "1"
11
- ? true
12
- : str === "false" || str === "0"
13
- ? false
14
- : (str as any); // wrong type
1
+ export const _httpQueryReadBoolean = (
2
+ str: string | null,
3
+ ): boolean | null | undefined =>
4
+ str === null
5
+ ? undefined
6
+ : str === "null"
7
+ ? null
8
+ : str.length === 0
9
+ ? true
10
+ : str === "true" || str === "1"
11
+ ? true
12
+ : str === "false" || str === "0"
13
+ ? false
14
+ : (str as any); // wrong type