New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@sinclair/typebox-codegen

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinclair/typebox-codegen - npm Package Compare versions

Comparing version
0.10.0
to
0.10.1
+1
-1
common/encoder.d.ts

@@ -5,3 +5,3 @@ export declare namespace MemberExpressionEncoder {

export declare namespace PropertyEncoder {
function Encode(value: string): string;
function Encode(key: string): string;
}

@@ -43,3 +43,3 @@ "use strict";

function IsAlpha(code) {
return (code >= 64 && code <= 90) || (code >= 97 && code <= 122);
return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
}

@@ -91,3 +91,3 @@ Character.IsAlpha = IsAlpha;

}
function IsSafeProperty(value) {
function IsAccessor(value) {
if (IsFirstCharacterNumeric(value))

@@ -103,9 +103,9 @@ return false;

}
function Quoted(value) {
return `'${value}'`;
function EscapeHyphen(key) {
return key.replace(/'/g, "\\'");
}
function Encode(value) {
return IsSafeProperty(value) ? value : Quoted(value);
function Encode(key) {
return IsAccessor(key) ? `${key}` : `'${EscapeHyphen(key)}'`;
}
PropertyEncoder.Encode = Encode;
})(PropertyEncoder || (exports.PropertyEncoder = PropertyEncoder = {}));

@@ -29,56 +29,5 @@ "use strict";

exports.ModelToTypeScript = void 0;
const formatter_1 = require("../common/formatter");
const index_1 = require("../common/index");
const compiler_1 = require("@sinclair/typebox/compiler");
const Types = require("@sinclair/typebox");
// ------------------------------------------------------------------
// Character
// ------------------------------------------------------------------
var Character;
(function (Character) {
function DollarSign(code) {
return code === 36;
}
Character.DollarSign = DollarSign;
function IsUnderscore(code) {
return code === 95;
}
Character.IsUnderscore = IsUnderscore;
function IsAlpha(code) {
return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
}
Character.IsAlpha = IsAlpha;
function IsNumeric(code) {
return code >= 48 && code <= 57;
}
Character.IsNumeric = IsNumeric;
})(Character || (Character = {}));
// ------------------------------------------------------------------
// PropertyKey
// ------------------------------------------------------------------
var PropertyKey;
(function (PropertyKey) {
function IsFirstCharacterNumeric(value) {
if (value.length === 0)
return false;
return Character.IsNumeric(value.charCodeAt(0));
}
function IsAccessor(value) {
if (IsFirstCharacterNumeric(value))
return false;
for (let i = 0; i < value.length; i++) {
const code = value.charCodeAt(i);
const check = Character.IsAlpha(code) || Character.IsNumeric(code) || Character.DollarSign(code) || Character.IsUnderscore(code);
if (!check)
return false;
}
return true;
}
function EscapeHyphen(key) {
return key.replace(/'/g, "\\'");
}
function Encode(key) {
return IsAccessor(key) ? `${key}` : `'${EscapeHyphen(key)}'`;
}
PropertyKey.Encode = Encode;
})(PropertyKey || (PropertyKey = {}));
var ModelToTypeScript;

@@ -146,3 +95,3 @@ (function (ModelToTypeScript) {

optional ? `${key}?: ${Visit(property)}` :
`${PropertyKey.Encode(key)}: ${Visit(property)}`);
`${index_1.PropertyEncoder.Encode(key)}: ${Visit(property)}`);
}).join(',\n');

@@ -273,5 +222,5 @@ return `{\n${properties}\n}`;

const output = [...definitions];
return formatter_1.Formatter.Format(output.join('\n\n'));
return index_1.Formatter.Format(output.join('\n\n'));
}
ModelToTypeScript.Generate = Generate;
})(ModelToTypeScript || (exports.ModelToTypeScript = ModelToTypeScript = {}));
{
"name": "@sinclair/typebox-codegen",
"version": "0.10.0",
"version": "0.10.1",
"description": "Code Generation Tools for TypeBox",

@@ -5,0 +5,0 @@ "main": "index.js",