@sinclair/typebox 0.27.3 → 0.27.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,7 +70,7 @@ var Character;
70
70
  }
71
71
  Character.IsUnderscore = IsUnderscore;
72
72
  function IsAlpha(code) {
73
- return (code >= 64 && code <= 90) || (code >= 97 && code <= 122);
73
+ return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
74
74
  }
75
75
  Character.IsAlpha = IsAlpha;
76
76
  function IsNumeric(code) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.27.3",
3
+ "version": "0.27.5",
4
4
  "description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
package/readme.md CHANGED
@@ -101,7 +101,7 @@ License MIT
101
101
  - [TypeCheck](#typecheck)
102
102
  - [Ajv](#typecheck-ajv)
103
103
  - [TypeCompiler](#typecheck-typecompiler)
104
- - [TypeSystem](#typecheck)
104
+ - [TypeSystem](#typesystem)
105
105
  - [Types](#typesystem-types)
106
106
  - [Formats](#typesystem-formats)
107
107
  - [Policies](#typesystem-policies)
package/typebox.d.ts CHANGED
@@ -3,7 +3,7 @@ export declare const Hint: unique symbol;
3
3
  export declare const Kind: unique symbol;
4
4
  export declare const PatternBoolean = "(true|false)";
5
5
  export declare const PatternNumber = "(0|[1-9][0-9]*)";
6
- export declare const PatternString = ".*";
6
+ export declare const PatternString = "(.*)";
7
7
  export declare const PatternBooleanExact: string;
8
8
  export declare const PatternNumberExact: string;
9
9
  export declare const PatternStringExact: string;
@@ -277,7 +277,7 @@ export interface TPromise<T extends TSchema = TSchema> extends TSchema {
277
277
  export type RecordTemplateLiteralObjectType<K extends TTemplateLiteral, T extends TSchema> = Ensure<TObject<Evaluate<{
278
278
  [_ in Static<K>]: T;
279
279
  }>>>;
280
- export type RecordTemplateLiteralType<K extends TTemplateLiteral, T extends TSchema> = IsTemplateLiteralFinite<K> extends true ? RecordTemplateLiteralObjectType<K, T> : TRecord<TString, T>;
280
+ export type RecordTemplateLiteralType<K extends TTemplateLiteral, T extends TSchema> = IsTemplateLiteralFinite<K> extends true ? RecordTemplateLiteralObjectType<K, T> : TRecord<K, T>;
281
281
  export type RecordUnionLiteralType<K extends TUnion<TLiteral<string | number>[]>, T extends TSchema> = Static<K> extends string ? Ensure<TObject<{
282
282
  [X in Static<K>]: T;
283
283
  }>> : never;
package/typebox.js CHANGED
@@ -39,7 +39,7 @@ exports.Kind = Symbol.for('TypeBox.Kind');
39
39
  // --------------------------------------------------------------------------
40
40
  exports.PatternBoolean = '(true|false)';
41
41
  exports.PatternNumber = '(0|[1-9][0-9]*)';
42
- exports.PatternString = '.*';
42
+ exports.PatternString = '(.*)';
43
43
  exports.PatternBooleanExact = `^${exports.PatternBoolean}$`;
44
44
  exports.PatternNumberExact = `^${exports.PatternNumber}$`;
45
45
  exports.PatternStringExact = `^${exports.PatternString}$`;
@@ -1520,9 +1520,6 @@ class TemplateLiteralParserError extends Error {
1520
1520
  exports.TemplateLiteralParserError = TemplateLiteralParserError;
1521
1521
  var TemplateLiteralParser;
1522
1522
  (function (TemplateLiteralParser) {
1523
- function Unescape(value) {
1524
- return value.replace(/\\/g, '');
1525
- }
1526
1523
  function IsNonEscaped(pattern, index, char) {
1527
1524
  return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
1528
1525
  }
@@ -1647,7 +1644,7 @@ var TemplateLiteralParser;
1647
1644
  return Or(pattern);
1648
1645
  if (IsPrecedenceAnd(pattern))
1649
1646
  return And(pattern);
1650
- return { type: 'const', const: Unescape(pattern) };
1647
+ return { type: 'const', const: pattern };
1651
1648
  }
1652
1649
  TemplateLiteralParser.Parse = Parse;
1653
1650
  /** Parses a pattern and strips forward and trailing ^ and $ */
@@ -1662,10 +1659,22 @@ var TemplateLiteralParser;
1662
1659
  var TemplateLiteralFinite;
1663
1660
  (function (TemplateLiteralFinite) {
1664
1661
  function IsNumber(expression) {
1665
- return expression.type === 'or' && expression.expr.length === 2 && expression.expr[0].type === 'const' && expression.expr[0].const === '0' && expression.expr[1].type === 'const' && expression.expr[1].const === '[1-9][0-9]*';
1662
+ // prettier-ignore
1663
+ return (expression.type === 'or' &&
1664
+ expression.expr.length === 2 &&
1665
+ expression.expr[0].type === 'const' &&
1666
+ expression.expr[0].const === '0' &&
1667
+ expression.expr[1].type === 'const' &&
1668
+ expression.expr[1].const === '[1-9][0-9]*');
1666
1669
  }
1667
1670
  function IsBoolean(expression) {
1668
- return expression.type === 'or' && expression.expr.length === 2 && expression.expr[0].type === 'const' && expression.expr[0].const === 'true' && expression.expr[1].type === 'const' && expression.expr[1].const === 'false';
1671
+ // prettier-ignore
1672
+ return (expression.type === 'or' &&
1673
+ expression.expr.length === 2 &&
1674
+ expression.expr[0].type === 'const' &&
1675
+ expression.expr[0].const === 'true' &&
1676
+ expression.expr[1].type === 'const' &&
1677
+ expression.expr[1].const === 'false');
1669
1678
  }
1670
1679
  function IsString(expression) {
1671
1680
  return expression.type === 'const' && expression.const === '.*';