🎩 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.33.22
to
0.33.23
+7
-0
build/cjs/compiler/compiler.d.ts

@@ -24,2 +24,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 {

@@ -26,0 +33,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");

@@ -85,2 +85,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

@@ -107,3 +121,3 @@ // ------------------------------------------------------------------

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

@@ -141,3 +155,3 @@ function Encode(object, key) {

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

@@ -144,0 +158,0 @@ LiteralString.Escape = Escape;

@@ -24,2 +24,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 {

@@ -26,0 +33,0 @@ readonly schema: TSchema;

@@ -80,2 +80,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

@@ -102,3 +116,3 @@ // ------------------------------------------------------------------

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

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

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

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

+2
-2
{
"name": "@sinclair/typebox",
"version": "0.33.22",
"version": "0.33.23",
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",

@@ -15,3 +15,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/sinclairzx81/typebox"
"url": "https://github.com/sinclairzx81/sinclair-typebox"
},

@@ -18,0 +18,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display