🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@sinclair/typebox

Package Overview
Dependencies
Maintainers
1
Versions
406
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinclair/typebox - npm Package Compare versions

Comparing version
0.30.5
to
0.30.6
+6
-1
compiler/compiler.js

@@ -154,2 +154,5 @@ "use strict";

}
function IsNumber(value) {
return typeof value === 'number' && globalThis.Number.isFinite(value);
}
// -------------------------------------------------------------------

@@ -352,3 +355,3 @@ // Polices

const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
const variable = CreateVariable(`new RegExp(/${patternKey}/)`);
const variable = CreateVariable(`${new RegExp(patternKey)}`);
const check1 = CreateExpression(patternSchema, references, 'value');

@@ -400,2 +403,4 @@ const check2 = Types.TypeGuard.TSchema(schema.additionalProperties) ? CreateExpression(schema.additionalProperties, references, value) : schema.additionalProperties === false ? 'false' : 'true';

return yield `${value}.length === 0`;
if (!IsNumber(schema.maxItems))
throw Error('MaxItems: Not a Number');
yield `(${value}.length === ${schema.maxItems})`;

@@ -402,0 +407,0 @@ for (let i = 0; i < schema.items.length; i++) {

+1
-1
{
"name": "@sinclair/typebox",
"version": "0.30.5",
"version": "0.30.6",
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",

@@ -5,0 +5,0 @@ "keywords": [