@sinclair/typebox 0.34.47 → 0.34.48
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.
|
@@ -220,7 +220,8 @@ var TypeCompiler;
|
|
|
220
220
|
if ((0, index_12.IsNumber)(schema.minItems))
|
|
221
221
|
yield `${value}.length >= ${schema.minItems}`;
|
|
222
222
|
const elementExpression = CreateExpression(schema.items, references, 'value');
|
|
223
|
-
yield `${value}.every((${parameter}) => ${elementExpression})
|
|
223
|
+
// yield `${value}.every((${parameter}) => ${elementExpression})` // issue: 1519
|
|
224
|
+
yield `((array) => { for(const ${parameter} of array) if(!(${elementExpression})) { return false }; return true; })(${value})`;
|
|
224
225
|
if ((0, type_1.IsSchema)(schema.contains) || (0, index_12.IsNumber)(schema.minContains) || (0, index_12.IsNumber)(schema.maxContains)) {
|
|
225
226
|
const containsSchema = (0, type_1.IsSchema)(schema.contains) ? schema.contains : (0, index_10.Never)();
|
|
226
227
|
const checkExpression = CreateExpression(containsSchema, references, 'value');
|
|
@@ -60,8 +60,9 @@ function FromArray(schema, references, value) {
|
|
|
60
60
|
if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
for (const element of value) {
|
|
64
|
+
if (!Visit(schema.items, references, element))
|
|
65
|
+
return false;
|
|
65
66
|
}
|
|
66
67
|
// prettier-ignore
|
|
67
68
|
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|
|
@@ -213,7 +213,8 @@ export var TypeCompiler;
|
|
|
213
213
|
if (IsNumber(schema.minItems))
|
|
214
214
|
yield `${value}.length >= ${schema.minItems}`;
|
|
215
215
|
const elementExpression = CreateExpression(schema.items, references, 'value');
|
|
216
|
-
yield `${value}.every((${parameter}) => ${elementExpression})
|
|
216
|
+
// yield `${value}.every((${parameter}) => ${elementExpression})` // issue: 1519
|
|
217
|
+
yield `((array) => { for(const ${parameter} of array) if(!(${elementExpression})) { return false }; return true; })(${value})`;
|
|
217
218
|
if (IsSchema(schema.contains) || IsNumber(schema.minContains) || IsNumber(schema.maxContains)) {
|
|
218
219
|
const containsSchema = IsSchema(schema.contains) ? schema.contains : Never();
|
|
219
220
|
const checkExpression = CreateExpression(containsSchema, references, 'value');
|
|
@@ -54,8 +54,9 @@ function FromArray(schema, references, value) {
|
|
|
54
54
|
if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
for (const element of value) {
|
|
58
|
+
if (!Visit(schema.items, references, element))
|
|
59
|
+
return false;
|
|
59
60
|
}
|
|
60
61
|
// prettier-ignore
|
|
61
62
|
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|