@@ -37,3 +37,4 @@ import * as Puny from './_puny.mjs'; | ||
| // rules (RFC 5892 Appendix A.1). These characters allow a subsequent | ||
| // Zero Width Joiner (U+200D) to be valid in a label. | ||
| // Zero Width Non-Joiner (U+200C) or Zero Width Joiner (U+200D) to | ||
| // be valid in a label. | ||
| // ------------------------------------------------------------------ | ||
@@ -149,6 +150,13 @@ const VIRAMA_CPS = new Set([ | ||
| break; // Hebrew GERESH | ||
| case 0x200d: | ||
| case 0x200c: // ZWNJ - RFC 5892 Appendix A.1 | ||
| // Note: Full validation requires a Unicode joining type table. We reject | ||
| // only when preceded by ASCII (U+0000-U+007F), which can never satisfy | ||
| // the Virama or cursive-joining rules. | ||
| if (prev === undefined || (prev < 0x0080 && !IsVirama(prev))) | ||
| return false; | ||
| break; | ||
| case 0x200d: // ZWJ - RFC 5892 Appendix A.2 | ||
| if (prev === undefined || !IsVirama(prev)) | ||
| return false; | ||
| break; // ZWJ | ||
| break; | ||
| case 0x30fb: /* Checked at end via hasJapanese */ | ||
@@ -155,0 +163,0 @@ break; // KATAKANA MIDDLE DOT |
@@ -16,3 +16,3 @@ // deno-fmt-ignore-file | ||
| // ------------------------------------------------------------------ | ||
| // KindedObject | ||
| // TypeObject | ||
| // | ||
@@ -22,6 +22,7 @@ // Types have non-enumerable properties that MUST be preserved on Clone. | ||
| // ------------------------------------------------------------------ | ||
| function IsKindedObject(value) { | ||
| return Guard.HasPropertyKey(value, '~kind'); | ||
| function IsTypeObject(value) { | ||
| return (Guard.HasPropertyKey(value, '~kind') || | ||
| Guard.HasPropertyKey(value, '~unsafe')); | ||
| } | ||
| function FromKindedObject(value) { | ||
| function FromTypeObject(value) { | ||
| const result = {}; | ||
@@ -59,3 +60,3 @@ const descriptors = Object.getOwnPropertyDescriptors(value); | ||
| return (Guard.IsClassInstance(value) ? FromClassInstance(value) : | ||
| IsKindedObject(value) ? FromKindedObject(value) : | ||
| IsTypeObject(value) ? FromTypeObject(value) : | ||
| FromPlainObject(value)); | ||
@@ -62,0 +63,0 @@ } |
+1
-1
| { | ||
| "name": "typebox", | ||
| "description": "Json Schema Type Builder with Static Type Resolution for TypeScript", | ||
| "version": "1.3.0", | ||
| "version": "1.3.1", | ||
| "keywords": [ | ||
@@ -6,0 +6,0 @@ "typescript", |
+7
-4
@@ -116,10 +116,13 @@ <div align='center'> | ||
| TypeBox includes a syntax engine that can transform TypeScript declarations into JSON Schema. The engine is a full syntactic frontend to Type.* and supports many advanced type-level constructs such as Conditional, Mapped, Indexed, Infer, Generics, Distributed types and more. This feature is implemented symmetrically at runtime and statically via TypeScript Template Literal types. | ||
| TypeBox includes a syntax engine that can transform TypeScript declarations into JSON Schema. The engine is a full syntactic frontend to Type.* and supports many advanced type-level constructs such as Conditional, Mapped, Indexed, Infer, Generics, Distributed types and more. This feature is implemented symmetrically at runtime and statically via TypeScript Template Literal types. | ||
| Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script) | ||
| ### Example | ||
| The following uses Script to parse TypeScript declarations into JSON Schema. | ||
| The following uses Script to parse TypeScript declarations into JSON Schema. | ||
| ```typescript | ||
| // Namespace | ||
| // Module | ||
| const Math = Type.Script(` | ||
@@ -131,3 +134,3 @@ type Vector2 = { x: number, y: number } | ||
| // Dependent Namespace | ||
| // Dependent Module | ||
| const { Mesh } = Type.Script({ ...Math }, ` | ||
@@ -134,0 +137,0 @@ type Vertex = { |
1460738
0.05%16607
0.05%373
0.81%