🎩 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
395
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.34.50
to
0.34.51
+7
-0
build/cjs/compiler/compiler.d.ts

@@ -28,2 +28,9 @@ import { ValueErrorIterator } from '../errors/index';

}
export declare namespace StringUtil {
/**
* Unquoted string values are embedded into single-quote string. This
* function ensures that embedded string cannot be escaped.
*/
function EscapeSingleQuote(value: string): string;
}
export declare class TypeCompilerUnknownTypeError extends TypeBoxError {

@@ -30,0 +37,0 @@ readonly schema: TSchema;

+17
-3
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeCompiler = exports.Policy = exports.TypeCompilerTypeGuardError = exports.TypeCompilerUnknownTypeError = exports.TypeCheck = void 0;
exports.TypeCompiler = exports.Policy = exports.TypeCompilerTypeGuardError = exports.TypeCompilerUnknownTypeError = exports.StringUtil = exports.TypeCheck = void 0;
const index_1 = require("../value/transform/index");

@@ -94,2 +94,16 @@ const index_2 = require("../errors/index");

// ------------------------------------------------------------------
// StringUtil
// ------------------------------------------------------------------
var StringUtil;
(function (StringUtil) {
/**
* Unquoted string values are embedded into single-quote string. This
* function ensures that embedded string cannot be escaped.
*/
function EscapeSingleQuote(value) {
return JSON.stringify(value).slice(1, -1).replace(/'/g, "\\'");
}
StringUtil.EscapeSingleQuote = EscapeSingleQuote;
})(StringUtil || (exports.StringUtil = StringUtil = {}));
// ------------------------------------------------------------------
// MemberExpression

@@ -116,3 +130,3 @@ // ------------------------------------------------------------------

function EscapeHyphen(key) {
return key.replace(/'/g, "\\'");
return StringUtil.EscapeSingleQuote(key);
}

@@ -150,3 +164,3 @@ function Encode(object, key) {

function Escape(content) {
return content.replace(/'/g, "\\'");
return StringUtil.EscapeSingleQuote(content);
}

@@ -153,0 +167,0 @@ LiteralString.Escape = Escape;

@@ -28,2 +28,9 @@ import { ValueErrorIterator } from '../errors/index.mjs';

}
export declare namespace StringUtil {
/**
* Unquoted string values are embedded into single-quote string. This
* function ensures that embedded string cannot be escaped.
*/
function EscapeSingleQuote(value: string): string;
}
export declare class TypeCompilerUnknownTypeError extends TypeBoxError {

@@ -30,0 +37,0 @@ readonly schema: TSchema;

@@ -89,2 +89,16 @@ import { TransformEncode, TransformDecode, HasTransform, TransformDecodeCheckError, TransformEncodeCheckError } from '../value/transform/index.mjs';

// ------------------------------------------------------------------
// StringUtil
// ------------------------------------------------------------------
export var StringUtil;
(function (StringUtil) {
/**
* Unquoted string values are embedded into single-quote string. This
* function ensures that embedded string cannot be escaped.
*/
function EscapeSingleQuote(value) {
return JSON.stringify(value).slice(1, -1).replace(/'/g, "\\'");
}
StringUtil.EscapeSingleQuote = EscapeSingleQuote;
})(StringUtil || (StringUtil = {}));
// ------------------------------------------------------------------
// MemberExpression

@@ -111,3 +125,3 @@ // ------------------------------------------------------------------

function EscapeHyphen(key) {
return key.replace(/'/g, "\\'");
return StringUtil.EscapeSingleQuote(key);
}

@@ -145,3 +159,3 @@ function Encode(object, key) {

function Escape(content) {
return content.replace(/'/g, "\\'");
return StringUtil.EscapeSingleQuote(content);
}

@@ -148,0 +162,0 @@ LiteralString.Escape = Escape;

+1
-1
{
"name": "@sinclair/typebox",
"version": "0.34.50",
"version": "0.34.51",
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",

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