@sinclair/typebox 0.28.12 → 0.28.13
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
|
@@ -194,13 +194,13 @@ var TypeCompiler;
|
|
|
194
194
|
}
|
|
195
195
|
function* Array(schema, references, value) {
|
|
196
196
|
const expression = CreateExpression(schema.items, references, 'value');
|
|
197
|
-
yield `Array.isArray(${value}) && ${value}.every(value => ${expression})`;
|
|
198
197
|
if (IsNumber(schema.minItems))
|
|
199
198
|
yield `${value}.length >= ${schema.minItems}`;
|
|
200
199
|
if (IsNumber(schema.maxItems))
|
|
201
200
|
yield `${value}.length <= ${schema.maxItems}`;
|
|
202
201
|
if (schema.uniqueItems === true)
|
|
203
202
|
yield `((function() { const set = new Set(); for(const element of ${value}) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true })())`;
|
|
203
|
+
yield `Array.isArray(${value}) && ${value}.every(value => ${expression})`;
|
|
204
204
|
}
|
|
205
205
|
function* BigInt(schema, references, value) {
|
|
206
206
|
yield `(typeof ${value} === 'bigint')`;
|