@sinclair/typebox 0.31.16 → 0.31.17
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/compiler/compiler.js +1 -1
- package/package.json +1 -1
package/compiler/compiler.js
CHANGED
|
@@ -228,7 +228,7 @@ var TypeCompiler;
|
|
|
228
228
|
const checkExpression = CreateExpression(containsSchema, references, 'value');
|
|
229
229
|
const checkMinContains = (0, guard_1.IsNumber)(schema.minContains) ? [`(count >= ${schema.minContains})`] : [];
|
|
230
230
|
const checkMaxContains = (0, guard_1.IsNumber)(schema.maxContains) ? [`(count <= ${schema.maxContains})`] : [];
|
|
231
|
-
const checkCount = `const count =
|
|
231
|
+
const checkCount = `const count = value.reduce((${accumulator}, ${parameter}) => ${checkExpression} ? acc + 1 : acc, 0)`;
|
|
232
232
|
const check = [`(count > 0)`, ...checkMinContains, ...checkMaxContains].join(' && ');
|
|
233
233
|
yield `((${parameter}) => { ${checkCount}; return ${check}})(${value})`;
|
|
234
234
|
}
|