typia 3.6.6 → 3.6.7
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/programmers/internal/application_number.js +20 -14
- package/lib/programmers/internal/application_number.js.map +1 -1
- package/lib/schemas/IJsonSchema.d.ts +4 -10
- package/package.json +2 -2
- package/src/programmers/internal/application_number.ts +19 -16
- package/src/schemas/IJsonSchema.ts +4 -10
|
@@ -37,10 +37,14 @@ var application_number = function (nullable, attribute) {
|
|
|
37
37
|
output.minimum = tag.value;
|
|
38
38
|
else if (tag.kind === "maximum")
|
|
39
39
|
output.maximum = tag.value;
|
|
40
|
-
else if (tag.kind === "exclusiveMinimum")
|
|
41
|
-
output.
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
else if (tag.kind === "exclusiveMinimum") {
|
|
41
|
+
output.minimum = tag.value;
|
|
42
|
+
output.exclusiveMinimum = true;
|
|
43
|
+
}
|
|
44
|
+
else if (tag.kind === "exclusiveMaximum") {
|
|
45
|
+
output.maximum = tag.value;
|
|
46
|
+
output.exclusiveMaximum = true;
|
|
47
|
+
}
|
|
44
48
|
else if (tag.kind === "multipleOf")
|
|
45
49
|
output.multipleOf = tag.value;
|
|
46
50
|
}
|
|
@@ -54,24 +58,26 @@ var application_number = function (nullable, attribute) {
|
|
|
54
58
|
}
|
|
55
59
|
if (output.type === "integer" &&
|
|
56
60
|
(attribute["x-typia-metaTags"] || []).find(function (tag) { return tag.kind === "type" && tag.value === "uint"; }))
|
|
57
|
-
if (output.minimum === undefined ||
|
|
61
|
+
if (output.minimum === undefined ||
|
|
62
|
+
(output.exclusiveMaximum !== true && output.minimum < 0))
|
|
58
63
|
output.minimum = 0;
|
|
59
|
-
else if (output.exclusiveMinimum
|
|
60
|
-
output.exclusiveMinimum < 0) {
|
|
61
|
-
delete output.exclusiveMinimum;
|
|
64
|
+
else if (output.exclusiveMinimum === true && output.minimum < -1) {
|
|
62
65
|
output.maximum = 0;
|
|
66
|
+
delete output.exclusiveMinimum;
|
|
63
67
|
}
|
|
64
68
|
output.default = (0, application_default_1.application_default)(attribute)(function (str) {
|
|
65
69
|
var value = Number(str);
|
|
66
70
|
var conditions = [!Number.isNaN(value)];
|
|
67
71
|
if (output.minimum !== undefined)
|
|
68
|
-
|
|
72
|
+
if (output.exclusiveMinimum === true)
|
|
73
|
+
conditions.push(value > output.minimum);
|
|
74
|
+
else
|
|
75
|
+
conditions.push(value >= output.minimum);
|
|
69
76
|
if (output.maximum !== undefined)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
conditions.push(value < output.exclusiveMaximum);
|
|
77
|
+
if (output.exclusiveMaximum === true)
|
|
78
|
+
conditions.push(value < output.maximum);
|
|
79
|
+
else
|
|
80
|
+
conditions.push(value <= output.maximum);
|
|
75
81
|
if (output.multipleOf !== undefined)
|
|
76
82
|
conditions.push(value % output.multipleOf === 0);
|
|
77
83
|
return conditions.every(function (cond) { return cond; });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application_number.js","sourceRoot":"","sources":["../../../src/programmers/internal/application_number.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA4D;AAKrD,IAAM,kBAAkB,GAAG,UAC9B,QAAiB,EACjB,SAAiC;;IAEjC,IAAM,MAAM,cACR,IAAI,EAAE,QAAgC,EACtC,QAAQ,UAAA,IACL,SAAS,CACf,CAAC;;QACF,KAAkB,IAAA,KAAA,SAAA,SAAS,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAA,gBAAA,4BAAE;YAAlD,IAAM,GAAG,WAAA;YAEV,IACI,GAAG,CAAC,IAAI,KAAK,MAAM;gBACnB,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC;gBAE7C,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;iBAEvB,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;gBAAE,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC;iBACvD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;gBAAE,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC;iBACvD,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB;
|
|
1
|
+
{"version":3,"file":"application_number.js","sourceRoot":"","sources":["../../../src/programmers/internal/application_number.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA4D;AAKrD,IAAM,kBAAkB,GAAG,UAC9B,QAAiB,EACjB,SAAiC;;IAEjC,IAAM,MAAM,cACR,IAAI,EAAE,QAAgC,EACtC,QAAQ,UAAA,IACL,SAAS,CACf,CAAC;;QACF,KAAkB,IAAA,KAAA,SAAA,SAAS,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAA,gBAAA,4BAAE;YAAlD,IAAM,GAAG,WAAA;YAEV,IACI,GAAG,CAAC,IAAI,KAAK,MAAM;gBACnB,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC;gBAE7C,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;iBAEvB,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;gBAAE,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC;iBACvD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;gBAAE,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC;iBACvD,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE;gBACtC,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC;gBAC3B,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;aAClC;iBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE;gBACxC,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC;gBAC3B,MAAM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B,IAAI,MAAM,CAAC,gBAAgB,KAAK,IAAI;gBAChC,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;;gBACvC,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;YAC/B,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC;QACrD,OAAO,UAAU,CAAC,KAAK,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,EAAJ,CAAI,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC,UAAC,GAAG,IAAK,OAAA,MAAM,CAAC,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC;IAGzB,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAlEW,QAAA,kBAAkB,sBAkE7B"}
|
|
@@ -25,8 +25,8 @@ export declare namespace IJsonSchema {
|
|
|
25
25
|
interface INumber extends IAtomic<"number"> {
|
|
26
26
|
minimum?: number;
|
|
27
27
|
maximum?: number;
|
|
28
|
-
exclusiveMinimum?:
|
|
29
|
-
exclusiveMaximum?:
|
|
28
|
+
exclusiveMinimum?: boolean;
|
|
29
|
+
exclusiveMaximum?: boolean;
|
|
30
30
|
multipleOf?: number;
|
|
31
31
|
}
|
|
32
32
|
interface IInteger extends IAtomic<"integer"> {
|
|
@@ -38,14 +38,8 @@ export declare namespace IJsonSchema {
|
|
|
38
38
|
* @type int
|
|
39
39
|
*/
|
|
40
40
|
maximum?: number;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
exclusiveMinimum?: number;
|
|
45
|
-
/**
|
|
46
|
-
* @type int
|
|
47
|
-
*/
|
|
48
|
-
exclusiveMaximum?: number;
|
|
41
|
+
exclusiveMinimum?: boolean;
|
|
42
|
+
exclusiveMaximum?: boolean;
|
|
49
43
|
/**
|
|
50
44
|
* @type int
|
|
51
45
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typia",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.7",
|
|
4
4
|
"description": "Superfast runtime validators with only one line",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"homepage": "https://github.com/samchon/typia#readme",
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"typescript": ">= 4.5.2"
|
|
68
|
+
"typescript": ">= 4.5.2 && < 5.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@fastify/type-provider-typebox": "^2.3.0",
|
|
@@ -23,10 +23,13 @@ export const application_number = (
|
|
|
23
23
|
// RANGE TAG
|
|
24
24
|
else if (tag.kind === "minimum") output.minimum = tag.value;
|
|
25
25
|
else if (tag.kind === "maximum") output.maximum = tag.value;
|
|
26
|
-
else if (tag.kind === "exclusiveMinimum")
|
|
27
|
-
output.
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
else if (tag.kind === "exclusiveMinimum") {
|
|
27
|
+
output.minimum = tag.value;
|
|
28
|
+
output.exclusiveMinimum = true;
|
|
29
|
+
} else if (tag.kind === "exclusiveMaximum") {
|
|
30
|
+
output.maximum = tag.value;
|
|
31
|
+
output.exclusiveMaximum = true;
|
|
32
|
+
}
|
|
30
33
|
// MULTIPLE-OF
|
|
31
34
|
else if (tag.kind === "multipleOf") output.multipleOf = tag.value;
|
|
32
35
|
}
|
|
@@ -38,14 +41,14 @@ export const application_number = (
|
|
|
38
41
|
(tag) => tag.kind === "type" && tag.value === "uint",
|
|
39
42
|
)
|
|
40
43
|
)
|
|
41
|
-
if (
|
|
44
|
+
if (
|
|
45
|
+
output.minimum === undefined ||
|
|
46
|
+
(output.exclusiveMaximum !== true && output.minimum < 0)
|
|
47
|
+
)
|
|
42
48
|
output.minimum = 0;
|
|
43
|
-
else if (
|
|
44
|
-
output.exclusiveMinimum !== undefined &&
|
|
45
|
-
output.exclusiveMinimum < 0
|
|
46
|
-
) {
|
|
47
|
-
delete output.exclusiveMinimum;
|
|
49
|
+
else if (output.exclusiveMinimum === true && output.minimum < -1) {
|
|
48
50
|
output.maximum = 0;
|
|
51
|
+
delete output.exclusiveMinimum;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
// DEFAULT CONFIGURATION
|
|
@@ -53,13 +56,13 @@ export const application_number = (
|
|
|
53
56
|
const value: number = Number(str);
|
|
54
57
|
const conditions: boolean[] = [!Number.isNaN(value)];
|
|
55
58
|
if (output.minimum !== undefined)
|
|
56
|
-
|
|
59
|
+
if (output.exclusiveMinimum === true)
|
|
60
|
+
conditions.push(value > output.minimum);
|
|
61
|
+
else conditions.push(value >= output.minimum);
|
|
57
62
|
if (output.maximum !== undefined)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
conditions.push(value
|
|
61
|
-
if (output.exclusiveMaximum !== undefined)
|
|
62
|
-
conditions.push(value < output.exclusiveMaximum);
|
|
63
|
+
if (output.exclusiveMaximum === true)
|
|
64
|
+
conditions.push(value < output.maximum);
|
|
65
|
+
else conditions.push(value <= output.maximum);
|
|
63
66
|
if (output.multipleOf !== undefined)
|
|
64
67
|
conditions.push(value % output.multipleOf === 0);
|
|
65
68
|
return conditions.every((cond) => cond);
|
|
@@ -47,8 +47,8 @@ export namespace IJsonSchema {
|
|
|
47
47
|
export interface INumber extends IAtomic<"number"> {
|
|
48
48
|
minimum?: number;
|
|
49
49
|
maximum?: number;
|
|
50
|
-
exclusiveMinimum?:
|
|
51
|
-
exclusiveMaximum?:
|
|
50
|
+
exclusiveMinimum?: boolean;
|
|
51
|
+
exclusiveMaximum?: boolean;
|
|
52
52
|
multipleOf?: number;
|
|
53
53
|
}
|
|
54
54
|
export interface IInteger extends IAtomic<"integer"> {
|
|
@@ -60,14 +60,8 @@ export namespace IJsonSchema {
|
|
|
60
60
|
* @type int
|
|
61
61
|
*/
|
|
62
62
|
maximum?: number;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*/
|
|
66
|
-
exclusiveMinimum?: number;
|
|
67
|
-
/**
|
|
68
|
-
* @type int
|
|
69
|
-
*/
|
|
70
|
-
exclusiveMaximum?: number;
|
|
63
|
+
exclusiveMinimum?: boolean;
|
|
64
|
+
exclusiveMaximum?: boolean;
|
|
71
65
|
/**
|
|
72
66
|
* @type int
|
|
73
67
|
*/
|