@sinclair/typebox 0.32.23 → 0.32.25
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/build/import/type/awaited/awaited.mjs +1 -1
- package/build/import/type/clone/value.mjs +8 -3
- package/build/import/type/composite/composite.mjs +14 -10
- package/build/import/type/const/const.mjs +4 -3
- package/build/import/type/deref/deref.d.mts +1 -1
- package/build/import/type/deref/deref.mjs +6 -4
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +4 -3
- package/build/import/type/exclude/exclude.mjs +1 -1
- package/build/import/type/extends/extends-from-mapped-result.mjs +4 -3
- package/build/import/type/extends/extends.mjs +1 -1
- package/build/import/type/extract/extract-from-mapped-result.mjs +4 -3
- package/build/import/type/extract/extract.mjs +1 -1
- package/build/import/type/guard/index.d.mts +1 -0
- package/build/import/type/guard/index.mjs +1 -0
- package/build/import/type/guard/kind.d.mts +136 -0
- package/build/import/type/guard/kind.mjs +217 -0
- package/build/import/type/guard/type.d.mts +2 -2
- package/build/import/type/indexed/indexed-from-mapped-result.mjs +5 -3
- package/build/import/type/indexed/indexed-property-keys.mjs +5 -4
- package/build/import/type/indexed/indexed.mjs +1 -1
- package/build/import/type/intersect/intersect-create.mjs +1 -1
- package/build/import/type/intersect/intersect-evaluated.mjs +1 -2
- package/build/import/type/intersect/intersect.mjs +1 -1
- package/build/import/type/intrinsic/intrinsic.mjs +1 -1
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +4 -3
- package/build/import/type/keyof/keyof-property-keys.mjs +5 -4
- package/build/import/type/keyof/keyof.mjs +1 -1
- package/build/import/type/mapped/mapped.d.mts +1 -1
- package/build/import/type/mapped/mapped.mjs +14 -12
- package/build/import/type/object/object.mjs +4 -2
- package/build/import/type/omit/omit-from-mapped-result.mjs +4 -3
- package/build/import/type/omit/omit.mjs +2 -4
- package/build/import/type/optional/optional-from-mapped-result.mjs +4 -3
- package/build/import/type/optional/optional.mjs +1 -1
- package/build/import/type/partial/partial-from-mapped-result.mjs +4 -3
- package/build/import/type/partial/partial.mjs +5 -4
- package/build/import/type/pick/pick-from-mapped-result.mjs +4 -3
- package/build/import/type/pick/pick.d.mts +1 -1
- package/build/import/type/pick/pick.mjs +6 -4
- package/build/import/type/readonly/readonly-from-mapped-result.mjs +4 -3
- package/build/import/type/readonly/readonly.mjs +1 -1
- package/build/import/type/record/record.mjs +5 -3
- package/build/import/type/required/required-from-mapped-result.mjs +4 -3
- package/build/import/type/required/required.mjs +5 -4
- package/build/import/type/rest/rest.mjs +4 -4
- package/build/import/type/sets/set.mjs +4 -1
- package/build/import/type/template-literal/pattern.mjs +1 -2
- package/build/import/type/transform/transform.mjs +1 -1
- package/build/import/type/union/union-evaluated.mjs +1 -1
- package/build/import/value/clean/clean.mjs +1 -1
- package/build/import/value/clone/clone.mjs +8 -2
- package/build/import/value/convert/convert.mjs +8 -6
- package/build/import/value/create/create.mjs +11 -7
- package/build/import/value/hash/hash.mjs +1 -1
- package/build/import/value/mutate/mutate.mjs +2 -2
- package/build/import/value/transform/decode.mjs +30 -30
- package/build/import/value/transform/encode.mjs +33 -30
- package/build/import/value/value/value.d.mts +2 -2
- package/build/import/value/value/value.mjs +1 -1
- package/build/require/type/awaited/awaited.js +4 -4
- package/build/require/type/clone/value.js +8 -3
- package/build/require/type/composite/composite.js +15 -11
- package/build/require/type/const/const.js +4 -3
- package/build/require/type/deref/deref.d.ts +1 -1
- package/build/require/type/deref/deref.js +17 -15
- package/build/require/type/exclude/exclude-from-mapped-result.js +4 -3
- package/build/require/type/exclude/exclude.js +4 -4
- package/build/require/type/extends/extends-from-mapped-result.js +4 -3
- package/build/require/type/extends/extends.js +3 -3
- package/build/require/type/extract/extract-from-mapped-result.js +4 -3
- package/build/require/type/extract/extract.js +4 -4
- package/build/require/type/guard/index.d.ts +1 -0
- package/build/require/type/guard/index.js +2 -1
- package/build/require/type/guard/kind.d.ts +136 -0
- package/build/require/type/guard/kind.js +266 -0
- package/build/require/type/guard/type.d.ts +2 -2
- package/build/require/type/indexed/indexed-from-mapped-result.js +5 -3
- package/build/require/type/indexed/indexed-property-keys.js +10 -9
- package/build/require/type/indexed/indexed.js +11 -11
- package/build/require/type/intersect/intersect-create.js +4 -4
- package/build/require/type/intersect/intersect-evaluated.js +4 -5
- package/build/require/type/intersect/intersect.js +2 -2
- package/build/require/type/intrinsic/intrinsic.js +5 -5
- package/build/require/type/keyof/keyof-from-mapped-result.js +4 -3
- package/build/require/type/keyof/keyof-property-keys.js +11 -10
- package/build/require/type/keyof/keyof.js +2 -2
- package/build/require/type/mapped/mapped.d.ts +1 -1
- package/build/require/type/mapped/mapped.js +29 -27
- package/build/require/type/object/object.js +6 -4
- package/build/require/type/omit/omit-from-mapped-result.js +4 -3
- package/build/require/type/omit/omit.js +8 -10
- package/build/require/type/optional/optional-from-mapped-result.js +4 -3
- package/build/require/type/optional/optional.js +2 -2
- package/build/require/type/partial/partial-from-mapped-result.js +4 -3
- package/build/require/type/partial/partial.js +9 -8
- package/build/require/type/pick/pick-from-mapped-result.js +4 -3
- package/build/require/type/pick/pick.d.ts +1 -1
- package/build/require/type/pick/pick.js +12 -10
- package/build/require/type/readonly/readonly-from-mapped-result.js +4 -3
- package/build/require/type/readonly/readonly.js +2 -2
- package/build/require/type/record/record.js +12 -10
- package/build/require/type/required/required-from-mapped-result.js +4 -3
- package/build/require/type/required/required.js +9 -8
- package/build/require/type/rest/rest.js +4 -4
- package/build/require/type/sets/set.js +4 -1
- package/build/require/type/template-literal/pattern.js +9 -10
- package/build/require/type/transform/transform.js +2 -2
- package/build/require/type/union/union-evaluated.js +3 -3
- package/build/require/value/clean/clean.js +1 -1
- package/build/require/value/clone/clone.js +8 -2
- package/build/require/value/convert/convert.js +7 -5
- package/build/require/value/create/create.js +11 -7
- package/build/require/value/hash/hash.js +1 -1
- package/build/require/value/mutate/mutate.js +2 -2
- package/build/require/value/transform/decode.js +30 -30
- package/build/require/value/transform/encode.js +33 -30
- package/build/require/value/value/value.d.ts +2 -2
- package/build/require/value/value/value.js +1 -1
- package/package.json +1 -1
- package/readme.md +4 -4
|
@@ -11,14 +11,14 @@ const union_create_1 = require("./union-create");
|
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
12
|
// TypeGuard
|
|
13
13
|
// ------------------------------------------------------------------
|
|
14
|
-
const
|
|
14
|
+
const kind_1 = require("../guard/kind");
|
|
15
15
|
// prettier-ignore
|
|
16
16
|
function IsUnionOptional(T) {
|
|
17
|
-
return T.some(L => (0,
|
|
17
|
+
return T.some(L => (0, kind_1.IsOptional)(L));
|
|
18
18
|
}
|
|
19
19
|
// prettier-ignore
|
|
20
20
|
function RemoveOptionalFromRest(T) {
|
|
21
|
-
return T.map(L => (0,
|
|
21
|
+
return T.map(L => (0, kind_1.IsOptional)(L) ? RemoveOptionalFromType(L) : L);
|
|
22
22
|
}
|
|
23
23
|
// prettier-ignore
|
|
24
24
|
function RemoveOptionalFromType(T) {
|
|
@@ -68,7 +68,7 @@ function FromRecord(schema, references, value) {
|
|
|
68
68
|
if (!(0, index_6.IsObject)(value))
|
|
69
69
|
return value;
|
|
70
70
|
const additionalProperties = schema.additionalProperties;
|
|
71
|
-
const propertyKeys = Object.
|
|
71
|
+
const propertyKeys = Object.getOwnPropertyNames(value);
|
|
72
72
|
const [propertyKey, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
73
73
|
const propertyKeyTest = new RegExp(propertyKey);
|
|
74
74
|
for (const key of propertyKeys) {
|
|
@@ -10,8 +10,14 @@ const index_1 = require("../guard/index");
|
|
|
10
10
|
// Clonable
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
12
|
function ObjectType(value) {
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const Acc = {};
|
|
14
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
15
|
+
Acc[key] = Clone(value[key]);
|
|
16
|
+
}
|
|
17
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
18
|
+
Acc[key] = Clone(value[key]);
|
|
19
|
+
}
|
|
20
|
+
return Acc;
|
|
15
21
|
}
|
|
16
22
|
function ArrayType(value) {
|
|
17
23
|
return value.map((element) => Clone(element));
|
|
@@ -146,11 +146,13 @@ function FromObject(schema, references, value) {
|
|
|
146
146
|
const isConvertable = (0, index_5.IsObject)(value);
|
|
147
147
|
if (!isConvertable)
|
|
148
148
|
return value;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
const result = {};
|
|
150
|
+
for (const key of Object.keys(value)) {
|
|
151
|
+
result[key] = (0, index_5.HasPropertyKey)(schema.properties, key)
|
|
152
|
+
? Visit(schema.properties[key], references, value[key])
|
|
153
|
+
: value[key];
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
154
156
|
}
|
|
155
157
|
function FromRecord(schema, references, value) {
|
|
156
158
|
const propertyKey = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
@@ -211,10 +211,13 @@ function FromObject(schema, references) {
|
|
|
211
211
|
}
|
|
212
212
|
else {
|
|
213
213
|
const required = new Set(schema.required);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
const Acc = {};
|
|
215
|
+
for (const [key, subschema] of Object.entries(schema.properties)) {
|
|
216
|
+
if (!required.has(key))
|
|
217
|
+
continue;
|
|
218
|
+
Acc[key] = Visit(subschema, references);
|
|
219
|
+
}
|
|
220
|
+
return Acc;
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
function FromPromise(schema, references) {
|
|
@@ -232,9 +235,10 @@ function FromRecord(schema, references) {
|
|
|
232
235
|
}
|
|
233
236
|
else if (!(keyPattern === index_6.PatternStringExact || keyPattern === index_6.PatternNumberExact)) {
|
|
234
237
|
const propertyKeys = keyPattern.slice(1, keyPattern.length - 1).split('|');
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
+
const Acc = {};
|
|
239
|
+
for (const key of propertyKeys)
|
|
240
|
+
Acc[key] = Visit(valueSchema, references);
|
|
241
|
+
return Acc;
|
|
238
242
|
}
|
|
239
243
|
else {
|
|
240
244
|
return {};
|
|
@@ -85,7 +85,7 @@ function NumberType(value) {
|
|
|
85
85
|
}
|
|
86
86
|
function ObjectType(value) {
|
|
87
87
|
FNV1A64(ByteMarker.Object);
|
|
88
|
-
for (const key of globalThis.Object.
|
|
88
|
+
for (const key of globalThis.Object.getOwnPropertyNames(value).sort()) {
|
|
89
89
|
Visit(key);
|
|
90
90
|
Visit(value[key]);
|
|
91
91
|
}
|
|
@@ -20,8 +20,8 @@ function ObjectType(root, path, current, next) {
|
|
|
20
20
|
index_2.ValuePointer.Set(root, path, (0, index_3.Clone)(next));
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
const currentKeys = Object.
|
|
24
|
-
const nextKeys = Object.
|
|
23
|
+
const currentKeys = Object.getOwnPropertyNames(current);
|
|
24
|
+
const nextKeys = Object.getOwnPropertyNames(next);
|
|
25
25
|
for (const currentKey of currentKeys) {
|
|
26
26
|
if (!nextKeys.includes(currentKey)) {
|
|
27
27
|
delete current[currentKey];
|
|
@@ -64,21 +64,21 @@ function FromIntersect(schema, references, path, value) {
|
|
|
64
64
|
if (!(0, index_7.IsStandardObject)(value) || (0, index_7.IsValueType)(value))
|
|
65
65
|
return Default(schema, path, value);
|
|
66
66
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
67
|
-
const knownProperties =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
const knownProperties = { ...value };
|
|
68
|
+
for (const key of knownKeys)
|
|
69
|
+
if (key in knownProperties) {
|
|
70
|
+
knownProperties[key] = Visit((0, index_4.Index)(schema, [key]), references, `${path}/${key}`, knownProperties[key]);
|
|
71
|
+
}
|
|
72
72
|
if (!(0, type_1.IsTransform)(schema.unevaluatedProperties)) {
|
|
73
73
|
return Default(schema, path, knownProperties);
|
|
74
74
|
}
|
|
75
75
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
76
76
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
77
|
-
const unknownProperties =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
const unknownProperties = { ...knownProperties };
|
|
78
|
+
for (const key of unknownKeys)
|
|
79
|
+
if (!knownKeys.includes(key)) {
|
|
80
|
+
unknownProperties[key] = Default(unevaluatedProperties, `${path}/${key}`, unknownProperties[key]);
|
|
81
|
+
}
|
|
82
82
|
return Default(schema, path, unknownProperties);
|
|
83
83
|
}
|
|
84
84
|
function FromNot(schema, references, path, value) {
|
|
@@ -89,21 +89,21 @@ function FromObject(schema, references, path, value) {
|
|
|
89
89
|
if (!(0, index_7.IsStandardObject)(value))
|
|
90
90
|
return Default(schema, path, value);
|
|
91
91
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
92
|
-
const knownProperties =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
const knownProperties = { ...value };
|
|
93
|
+
for (const key of knownKeys)
|
|
94
|
+
if (key in knownProperties) {
|
|
95
|
+
knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
96
|
+
}
|
|
97
97
|
if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
|
|
98
98
|
return Default(schema, path, knownProperties);
|
|
99
99
|
}
|
|
100
100
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
101
101
|
const additionalProperties = schema.additionalProperties;
|
|
102
|
-
const unknownProperties =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
const unknownProperties = { ...knownProperties };
|
|
103
|
+
for (const key of unknownKeys)
|
|
104
|
+
if (!knownKeys.includes(key)) {
|
|
105
|
+
unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
106
|
+
}
|
|
107
107
|
return Default(schema, path, unknownProperties);
|
|
108
108
|
}
|
|
109
109
|
// prettier-ignore
|
|
@@ -112,21 +112,21 @@ function FromRecord(schema, references, path, value) {
|
|
|
112
112
|
return Default(schema, path, value);
|
|
113
113
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
114
114
|
const knownKeys = new RegExp(pattern);
|
|
115
|
-
const knownProperties =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
const knownProperties = { ...value };
|
|
116
|
+
for (const key of Object.getOwnPropertyNames(value))
|
|
117
|
+
if (knownKeys.test(key)) {
|
|
118
|
+
knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
119
|
+
}
|
|
120
120
|
if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
|
|
121
121
|
return Default(schema, path, knownProperties);
|
|
122
122
|
}
|
|
123
123
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
124
124
|
const additionalProperties = schema.additionalProperties;
|
|
125
|
-
const unknownProperties =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
const unknownProperties = { ...knownProperties };
|
|
126
|
+
for (const key of unknownKeys)
|
|
127
|
+
if (!knownKeys.test(key)) {
|
|
128
|
+
unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
129
|
+
}
|
|
130
130
|
return Default(schema, path, unknownProperties);
|
|
131
131
|
}
|
|
132
132
|
// prettier-ignore
|
|
@@ -65,21 +65,22 @@ function FromIntersect(schema, references, path, value) {
|
|
|
65
65
|
if (!(0, index_7.IsStandardObject)(value) || (0, index_7.IsValueType)(value))
|
|
66
66
|
return defaulted;
|
|
67
67
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
68
|
-
const knownProperties =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const knownProperties = { ...defaulted };
|
|
69
|
+
for (const key of knownKeys)
|
|
70
|
+
if (key in knownProperties) {
|
|
71
|
+
knownProperties[key] = Visit((0, index_4.Index)(schema, [key]), references, `${path}/${key}`, knownProperties[key]);
|
|
72
|
+
}
|
|
73
73
|
if (!(0, type_1.IsTransform)(schema.unevaluatedProperties)) {
|
|
74
74
|
return Default(schema, path, knownProperties);
|
|
75
75
|
}
|
|
76
76
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
77
77
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
const properties = { ...knownProperties };
|
|
79
|
+
for (const key of unknownKeys)
|
|
80
|
+
if (!knownKeys.includes(key)) {
|
|
81
|
+
properties[key] = Default(unevaluatedProperties, `${path}/${key}`, properties[key]);
|
|
82
|
+
}
|
|
83
|
+
return properties;
|
|
83
84
|
}
|
|
84
85
|
// prettier-ignore
|
|
85
86
|
function FromNot(schema, references, path, value) {
|
|
@@ -91,21 +92,22 @@ function FromObject(schema, references, path, value) {
|
|
|
91
92
|
if (!(0, index_7.IsStandardObject)(value))
|
|
92
93
|
return defaulted;
|
|
93
94
|
const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema);
|
|
94
|
-
const knownProperties =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
const knownProperties = { ...defaulted };
|
|
96
|
+
for (const key of knownKeys)
|
|
97
|
+
if (key in value) {
|
|
98
|
+
knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
99
|
+
}
|
|
99
100
|
if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
|
|
100
101
|
return knownProperties;
|
|
101
102
|
}
|
|
102
103
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
103
104
|
const additionalProperties = schema.additionalProperties;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
const properties = { ...knownProperties };
|
|
106
|
+
for (const key of unknownKeys)
|
|
107
|
+
if (!knownKeys.includes(key)) {
|
|
108
|
+
properties[key] = Default(additionalProperties, `${path}/${key}`, properties[key]);
|
|
109
|
+
}
|
|
110
|
+
return properties;
|
|
109
111
|
}
|
|
110
112
|
// prettier-ignore
|
|
111
113
|
function FromRecord(schema, references, path, value) {
|
|
@@ -114,21 +116,22 @@ function FromRecord(schema, references, path, value) {
|
|
|
114
116
|
return defaulted;
|
|
115
117
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
116
118
|
const knownKeys = new RegExp(pattern);
|
|
117
|
-
const knownProperties =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
const knownProperties = { ...defaulted };
|
|
120
|
+
for (const key of Object.getOwnPropertyNames(value))
|
|
121
|
+
if (knownKeys.test(key)) {
|
|
122
|
+
knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
123
|
+
}
|
|
122
124
|
if (!(0, type_1.IsSchema)(schema.additionalProperties)) {
|
|
123
125
|
return Default(schema, path, knownProperties);
|
|
124
126
|
}
|
|
125
127
|
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
126
128
|
const additionalProperties = schema.additionalProperties;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
const properties = { ...knownProperties };
|
|
130
|
+
for (const key of unknownKeys)
|
|
131
|
+
if (!knownKeys.test(key)) {
|
|
132
|
+
properties[key] = Default(additionalProperties, `${path}/${key}`, properties[key]);
|
|
133
|
+
}
|
|
134
|
+
return properties;
|
|
132
135
|
}
|
|
133
136
|
// prettier-ignore
|
|
134
137
|
function FromRef(schema, references, path, value) {
|
|
@@ -19,9 +19,9 @@ export declare function Check<T extends TSchema>(schema: T, value: unknown): val
|
|
|
19
19
|
export declare function Clean(schema: TSchema, references: TSchema[], value: unknown): unknown;
|
|
20
20
|
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
|
|
21
21
|
export declare function Clean(schema: TSchema, value: unknown): unknown;
|
|
22
|
-
/** Converts any type mismatched values to their target type if a reasonable conversion is possible */
|
|
22
|
+
/** Converts any type mismatched values to their target type if a reasonable conversion is possible. */
|
|
23
23
|
export declare function Convert(schema: TSchema, references: TSchema[], value: unknown): unknown;
|
|
24
|
-
/** Converts any type mismatched values to their target type if a reasonable conversion is
|
|
24
|
+
/** Converts any type mismatched values to their target type if a reasonable conversion is possible. */
|
|
25
25
|
export declare function Convert(schema: TSchema, value: unknown): unknown;
|
|
26
26
|
/** Returns a structural clone of the given value */
|
|
27
27
|
export declare function Clone<T>(value: T): T;
|
|
@@ -35,7 +35,7 @@ function Clean(...args) {
|
|
|
35
35
|
return index_9.Clean.apply(index_9.Clean, args);
|
|
36
36
|
}
|
|
37
37
|
exports.Clean = Clean;
|
|
38
|
-
/** Converts any type mismatched values to their target type if a reasonable conversion is possible */
|
|
38
|
+
/** Converts any type mismatched values to their target type if a reasonable conversion is possible. */
|
|
39
39
|
function Convert(...args) {
|
|
40
40
|
return index_7.Convert.apply(index_7.Convert, args);
|
|
41
41
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1804,11 +1804,11 @@ The following table lists esbuild compiled and minified sizes for each TypeBox m
|
|
|
1804
1804
|
┌──────────────────────┬────────────┬────────────┬─────────────┐
|
|
1805
1805
|
│ (index) │ Compiled │ Minified │ Compression │
|
|
1806
1806
|
├──────────────────────┼────────────┼────────────┼─────────────┤
|
|
1807
|
-
│ typebox/compiler │ '
|
|
1808
|
-
│ typebox/errors │ '
|
|
1807
|
+
│ typebox/compiler │ '126.9 kb' │ ' 55.7 kb' │ '2.28 x' │
|
|
1808
|
+
│ typebox/errors │ ' 46.1 kb' │ ' 20.8 kb' │ '2.22 x' │
|
|
1809
1809
|
│ typebox/system │ ' 4.7 kb' │ ' 2.0 kb' │ '2.33 x' │
|
|
1810
|
-
│ typebox/value │ '
|
|
1811
|
-
│ typebox │ '
|
|
1810
|
+
│ typebox/value │ '152.2 kb' │ ' 64.5 kb' │ '2.36 x' │
|
|
1811
|
+
│ typebox │ ' 95.7 kb' │ ' 39.8 kb' │ '2.40 x' │
|
|
1812
1812
|
└──────────────────────┴────────────┴────────────┴─────────────┘
|
|
1813
1813
|
```
|
|
1814
1814
|
|