@sinclair/typebox 0.32.33 → 0.32.34

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.
Files changed (133) hide show
  1. package/build/cjs/errors/errors.js +2 -2
  2. package/build/cjs/errors/function.js +3 -4
  3. package/build/cjs/type/any/any.js +1 -2
  4. package/build/cjs/type/array/array.js +1 -2
  5. package/build/cjs/type/async-iterator/async-iterator.js +1 -2
  6. package/build/cjs/type/awaited/awaited.js +1 -2
  7. package/build/cjs/type/bigint/bigint.js +1 -2
  8. package/build/cjs/type/boolean/boolean.js +1 -2
  9. package/build/cjs/type/clone/type.js +2 -3
  10. package/build/cjs/type/clone/value.js +1 -2
  11. package/build/cjs/type/composite/composite.js +1 -2
  12. package/build/cjs/type/const/const.js +1 -2
  13. package/build/cjs/type/constructor/constructor.js +1 -2
  14. package/build/cjs/type/constructor-parameters/constructor-parameters.js +1 -2
  15. package/build/cjs/type/date/date.js +1 -2
  16. package/build/cjs/type/deref/deref.js +1 -2
  17. package/build/cjs/type/discard/discard.js +1 -2
  18. package/build/cjs/type/enum/enum.js +1 -2
  19. package/build/cjs/type/exclude/exclude-from-mapped-result.js +1 -2
  20. package/build/cjs/type/exclude/exclude-from-template-literal.js +1 -2
  21. package/build/cjs/type/exclude/exclude.js +1 -2
  22. package/build/cjs/type/extends/extends-check.js +2 -2
  23. package/build/cjs/type/extends/extends-from-mapped-key.js +1 -2
  24. package/build/cjs/type/extends/extends-from-mapped-result.js +1 -2
  25. package/build/cjs/type/extends/extends-undefined.js +1 -2
  26. package/build/cjs/type/extends/extends.js +1 -2
  27. package/build/cjs/type/extract/extract-from-mapped-result.js +1 -2
  28. package/build/cjs/type/extract/extract-from-template-literal.js +1 -2
  29. package/build/cjs/type/extract/extract.js +1 -2
  30. package/build/cjs/type/function/function.js +1 -2
  31. package/build/cjs/type/guard/kind.js +45 -46
  32. package/build/cjs/type/guard/type.js +48 -48
  33. package/build/cjs/type/guard/value.js +15 -16
  34. package/build/cjs/type/helpers/helpers.js +1 -2
  35. package/build/cjs/type/indexed/indexed-from-mapped-key.js +1 -2
  36. package/build/cjs/type/indexed/indexed-from-mapped-result.js +1 -2
  37. package/build/cjs/type/indexed/indexed-property-keys.js +1 -2
  38. package/build/cjs/type/indexed/indexed.js +3 -4
  39. package/build/cjs/type/instance-type/instance-type.js +1 -2
  40. package/build/cjs/type/integer/integer.js +1 -2
  41. package/build/cjs/type/intersect/intersect-create.js +1 -2
  42. package/build/cjs/type/intersect/intersect-evaluated.js +1 -2
  43. package/build/cjs/type/intersect/intersect.js +1 -2
  44. package/build/cjs/type/intrinsic/capitalize.js +1 -2
  45. package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js +1 -2
  46. package/build/cjs/type/intrinsic/intrinsic.js +1 -2
  47. package/build/cjs/type/intrinsic/lowercase.js +1 -2
  48. package/build/cjs/type/intrinsic/uncapitalize.js +1 -2
  49. package/build/cjs/type/intrinsic/uppercase.js +1 -2
  50. package/build/cjs/type/iterator/iterator.js +1 -2
  51. package/build/cjs/type/keyof/keyof-from-mapped-result.js +1 -2
  52. package/build/cjs/type/keyof/keyof-property-entries.js +1 -2
  53. package/build/cjs/type/keyof/keyof-property-keys.js +2 -3
  54. package/build/cjs/type/keyof/keyof.js +2 -3
  55. package/build/cjs/type/literal/literal.js +1 -2
  56. package/build/cjs/type/mapped/mapped-key.js +1 -2
  57. package/build/cjs/type/mapped/mapped-result.js +1 -2
  58. package/build/cjs/type/mapped/mapped.js +2 -3
  59. package/build/cjs/type/never/never.js +1 -2
  60. package/build/cjs/type/not/not.js +1 -2
  61. package/build/cjs/type/null/null.js +1 -2
  62. package/build/cjs/type/number/number.js +1 -2
  63. package/build/cjs/type/omit/omit-from-mapped-key.js +1 -2
  64. package/build/cjs/type/omit/omit-from-mapped-result.js +1 -2
  65. package/build/cjs/type/omit/omit.js +1 -2
  66. package/build/cjs/type/optional/optional-from-mapped-result.js +1 -2
  67. package/build/cjs/type/optional/optional.js +1 -2
  68. package/build/cjs/type/parameters/parameters.js +1 -2
  69. package/build/cjs/type/partial/partial-from-mapped-result.js +1 -2
  70. package/build/cjs/type/partial/partial.js +1 -2
  71. package/build/cjs/type/pick/pick-from-mapped-key.js +1 -2
  72. package/build/cjs/type/pick/pick-from-mapped-result.js +1 -2
  73. package/build/cjs/type/pick/pick.d.ts +2 -2
  74. package/build/cjs/type/pick/pick.js +1 -2
  75. package/build/cjs/type/promise/promise.js +1 -2
  76. package/build/cjs/type/readonly/readonly-from-mapped-result.js +1 -2
  77. package/build/cjs/type/readonly/readonly.js +1 -2
  78. package/build/cjs/type/readonly-optional/readonly-optional.js +1 -2
  79. package/build/cjs/type/record/record.js +1 -2
  80. package/build/cjs/type/recursive/recursive.js +1 -2
  81. package/build/cjs/type/ref/ref.js +1 -2
  82. package/build/cjs/type/regexp/regexp.js +1 -2
  83. package/build/cjs/type/registry/format.js +6 -7
  84. package/build/cjs/type/registry/type.js +6 -7
  85. package/build/cjs/type/required/required-from-mapped-result.js +1 -2
  86. package/build/cjs/type/required/required.js +1 -2
  87. package/build/cjs/type/rest/rest.js +1 -2
  88. package/build/cjs/type/return-type/return-type.js +1 -2
  89. package/build/cjs/type/sets/set.js +8 -9
  90. package/build/cjs/type/strict/strict.js +1 -2
  91. package/build/cjs/type/string/string.js +1 -2
  92. package/build/cjs/type/symbol/symbol.js +1 -2
  93. package/build/cjs/type/template-literal/finite.js +3 -3
  94. package/build/cjs/type/template-literal/generate.d.ts +1 -1
  95. package/build/cjs/type/template-literal/generate.js +3 -3
  96. package/build/cjs/type/template-literal/parse.js +3 -3
  97. package/build/cjs/type/template-literal/pattern.js +2 -2
  98. package/build/cjs/type/template-literal/syntax.js +1 -2
  99. package/build/cjs/type/template-literal/template-literal.js +1 -2
  100. package/build/cjs/type/template-literal/union.js +1 -2
  101. package/build/cjs/type/transform/transform.js +2 -2
  102. package/build/cjs/type/tuple/tuple.js +1 -2
  103. package/build/cjs/type/type/index.d.ts +1 -1
  104. package/build/cjs/type/uint8array/uint8array.js +1 -2
  105. package/build/cjs/type/undefined/undefined.js +1 -2
  106. package/build/cjs/type/union/union-create.js +1 -2
  107. package/build/cjs/type/union/union-evaluated.js +1 -2
  108. package/build/cjs/type/union/union.js +1 -2
  109. package/build/cjs/type/unknown/unknown.js +1 -2
  110. package/build/cjs/type/unsafe/unsafe.js +1 -2
  111. package/build/cjs/type/void/void.js +1 -2
  112. package/build/cjs/value/cast/cast.js +2 -2
  113. package/build/cjs/value/check/check.js +2 -2
  114. package/build/cjs/value/clean/clean.js +1 -2
  115. package/build/cjs/value/clone/clone.js +1 -2
  116. package/build/cjs/value/convert/convert.js +1 -2
  117. package/build/cjs/value/create/create.js +2 -2
  118. package/build/cjs/value/default/default.js +1 -2
  119. package/build/cjs/value/delta/delta.js +3 -3
  120. package/build/cjs/value/deref/deref.js +2 -2
  121. package/build/cjs/value/equal/equal.js +1 -2
  122. package/build/cjs/value/guard/guard.js +34 -35
  123. package/build/cjs/value/hash/hash.js +2 -2
  124. package/build/cjs/value/mutate/mutate.js +2 -2
  125. package/build/cjs/value/pointer/pointer.js +6 -6
  126. package/build/cjs/value/transform/decode.js +2 -2
  127. package/build/cjs/value/transform/encode.js +2 -2
  128. package/build/cjs/value/transform/has.js +1 -2
  129. package/build/cjs/value/value/value.js +15 -16
  130. package/build/esm/type/pick/pick.d.mts +2 -2
  131. package/build/esm/type/template-literal/generate.d.mts +1 -1
  132. package/build/esm/type/type/index.d.mts +1 -1
  133. package/package.json +1 -1
@@ -1,229 +1,229 @@
1
1
  "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IsSchema = exports.IsKind = exports.IsVoid = exports.IsUnsafe = exports.IsUnknown = exports.IsUint8Array = exports.IsUnion = exports.IsUndefined = exports.IsTuple = exports.IsTransform = exports.IsThis = exports.IsTemplateLiteral = exports.IsSymbol = exports.IsString = exports.IsRegExp = exports.IsRef = exports.IsRecursive = exports.IsRecord = exports.IsPromise = exports.IsObject = exports.IsNumber = exports.IsNull = exports.IsNot = exports.IsNever = exports.IsMappedResult = exports.IsMappedKey = exports.IsLiteral = exports.IsLiteralBoolean = exports.IsLiteralNumber = exports.IsLiteralString = exports.IsKindOf = exports.IsIterator = exports.IsIntersect = exports.IsProperties = exports.IsInteger = exports.IsFunction = exports.IsDate = exports.IsConstructor = exports.IsBoolean = exports.IsBigInt = exports.IsAsyncIterator = exports.IsArray = exports.IsAny = exports.IsOptional = exports.IsReadonly = void 0;
4
+ exports.IsReadonly = IsReadonly;
5
+ exports.IsOptional = IsOptional;
6
+ exports.IsAny = IsAny;
7
+ exports.IsArray = IsArray;
8
+ exports.IsAsyncIterator = IsAsyncIterator;
9
+ exports.IsBigInt = IsBigInt;
10
+ exports.IsBoolean = IsBoolean;
11
+ exports.IsConstructor = IsConstructor;
12
+ exports.IsDate = IsDate;
13
+ exports.IsFunction = IsFunction;
14
+ exports.IsInteger = IsInteger;
15
+ exports.IsProperties = IsProperties;
16
+ exports.IsIntersect = IsIntersect;
17
+ exports.IsIterator = IsIterator;
18
+ exports.IsKindOf = IsKindOf;
19
+ exports.IsLiteralString = IsLiteralString;
20
+ exports.IsLiteralNumber = IsLiteralNumber;
21
+ exports.IsLiteralBoolean = IsLiteralBoolean;
22
+ exports.IsLiteral = IsLiteral;
23
+ exports.IsMappedKey = IsMappedKey;
24
+ exports.IsMappedResult = IsMappedResult;
25
+ exports.IsNever = IsNever;
26
+ exports.IsNot = IsNot;
27
+ exports.IsNull = IsNull;
28
+ exports.IsNumber = IsNumber;
29
+ exports.IsObject = IsObject;
30
+ exports.IsPromise = IsPromise;
31
+ exports.IsRecord = IsRecord;
32
+ exports.IsRecursive = IsRecursive;
33
+ exports.IsRef = IsRef;
34
+ exports.IsRegExp = IsRegExp;
35
+ exports.IsString = IsString;
36
+ exports.IsSymbol = IsSymbol;
37
+ exports.IsTemplateLiteral = IsTemplateLiteral;
38
+ exports.IsThis = IsThis;
39
+ exports.IsTransform = IsTransform;
40
+ exports.IsTuple = IsTuple;
41
+ exports.IsUndefined = IsUndefined;
42
+ exports.IsUnion = IsUnion;
43
+ exports.IsUint8Array = IsUint8Array;
44
+ exports.IsUnknown = IsUnknown;
45
+ exports.IsUnsafe = IsUnsafe;
46
+ exports.IsVoid = IsVoid;
47
+ exports.IsKind = IsKind;
48
+ exports.IsSchema = IsSchema;
5
49
  const ValueGuard = require("./value");
6
50
  const index_1 = require("../symbols/index");
7
51
  /** `[Kind-Only]` Returns true if this value has a Readonly symbol */
8
52
  function IsReadonly(value) {
9
53
  return ValueGuard.IsObject(value) && value[index_1.ReadonlyKind] === 'Readonly';
10
54
  }
11
- exports.IsReadonly = IsReadonly;
12
55
  /** `[Kind-Only]` Returns true if this value has a Optional symbol */
13
56
  function IsOptional(value) {
14
57
  return ValueGuard.IsObject(value) && value[index_1.OptionalKind] === 'Optional';
15
58
  }
16
- exports.IsOptional = IsOptional;
17
59
  /** `[Kind-Only]` Returns true if the given value is TAny */
18
60
  function IsAny(value) {
19
61
  return IsKindOf(value, 'Any');
20
62
  }
21
- exports.IsAny = IsAny;
22
63
  /** `[Kind-Only]` Returns true if the given value is TArray */
23
64
  function IsArray(value) {
24
65
  return IsKindOf(value, 'Array');
25
66
  }
26
- exports.IsArray = IsArray;
27
67
  /** `[Kind-Only]` Returns true if the given value is TAsyncIterator */
28
68
  function IsAsyncIterator(value) {
29
69
  return IsKindOf(value, 'AsyncIterator');
30
70
  }
31
- exports.IsAsyncIterator = IsAsyncIterator;
32
71
  /** `[Kind-Only]` Returns true if the given value is TBigInt */
33
72
  function IsBigInt(value) {
34
73
  return IsKindOf(value, 'BigInt');
35
74
  }
36
- exports.IsBigInt = IsBigInt;
37
75
  /** `[Kind-Only]` Returns true if the given value is TBoolean */
38
76
  function IsBoolean(value) {
39
77
  return IsKindOf(value, 'Boolean');
40
78
  }
41
- exports.IsBoolean = IsBoolean;
42
79
  /** `[Kind-Only]` Returns true if the given value is TConstructor */
43
80
  function IsConstructor(value) {
44
81
  return IsKindOf(value, 'Constructor');
45
82
  }
46
- exports.IsConstructor = IsConstructor;
47
83
  /** `[Kind-Only]` Returns true if the given value is TDate */
48
84
  function IsDate(value) {
49
85
  return IsKindOf(value, 'Date');
50
86
  }
51
- exports.IsDate = IsDate;
52
87
  /** `[Kind-Only]` Returns true if the given value is TFunction */
53
88
  function IsFunction(value) {
54
89
  return IsKindOf(value, 'Function');
55
90
  }
56
- exports.IsFunction = IsFunction;
57
91
  /** `[Kind-Only]` Returns true if the given value is TInteger */
58
92
  function IsInteger(value) {
59
93
  return IsKindOf(value, 'Integer');
60
94
  }
61
- exports.IsInteger = IsInteger;
62
95
  /** `[Kind-Only]` Returns true if the given schema is TProperties */
63
96
  function IsProperties(value) {
64
97
  return ValueGuard.IsObject(value);
65
98
  }
66
- exports.IsProperties = IsProperties;
67
99
  /** `[Kind-Only]` Returns true if the given value is TIntersect */
68
100
  function IsIntersect(value) {
69
101
  return IsKindOf(value, 'Intersect');
70
102
  }
71
- exports.IsIntersect = IsIntersect;
72
103
  /** `[Kind-Only]` Returns true if the given value is TIterator */
73
104
  function IsIterator(value) {
74
105
  return IsKindOf(value, 'Iterator');
75
106
  }
76
- exports.IsIterator = IsIterator;
77
107
  /** `[Kind-Only]` Returns true if the given value is a TKind with the given name. */
78
108
  function IsKindOf(value, kind) {
79
109
  return ValueGuard.IsObject(value) && index_1.Kind in value && value[index_1.Kind] === kind;
80
110
  }
81
- exports.IsKindOf = IsKindOf;
82
111
  /** `[Kind-Only]` Returns true if the given value is TLiteral<string> */
83
112
  function IsLiteralString(value) {
84
113
  return IsLiteral(value) && ValueGuard.IsString(value.const);
85
114
  }
86
- exports.IsLiteralString = IsLiteralString;
87
115
  /** `[Kind-Only]` Returns true if the given value is TLiteral<number> */
88
116
  function IsLiteralNumber(value) {
89
117
  return IsLiteral(value) && ValueGuard.IsNumber(value.const);
90
118
  }
91
- exports.IsLiteralNumber = IsLiteralNumber;
92
119
  /** `[Kind-Only]` Returns true if the given value is TLiteral<boolean> */
93
120
  function IsLiteralBoolean(value) {
94
121
  return IsLiteral(value) && ValueGuard.IsBoolean(value.const);
95
122
  }
96
- exports.IsLiteralBoolean = IsLiteralBoolean;
97
123
  /** `[Kind-Only]` Returns true if the given value is TLiteral */
98
124
  function IsLiteral(value) {
99
125
  return IsKindOf(value, 'Literal');
100
126
  }
101
- exports.IsLiteral = IsLiteral;
102
127
  /** `[Kind-Only]` Returns true if the given value is a TMappedKey */
103
128
  function IsMappedKey(value) {
104
129
  return IsKindOf(value, 'MappedKey');
105
130
  }
106
- exports.IsMappedKey = IsMappedKey;
107
131
  /** `[Kind-Only]` Returns true if the given value is TMappedResult */
108
132
  function IsMappedResult(value) {
109
133
  return IsKindOf(value, 'MappedResult');
110
134
  }
111
- exports.IsMappedResult = IsMappedResult;
112
135
  /** `[Kind-Only]` Returns true if the given value is TNever */
113
136
  function IsNever(value) {
114
137
  return IsKindOf(value, 'Never');
115
138
  }
116
- exports.IsNever = IsNever;
117
139
  /** `[Kind-Only]` Returns true if the given value is TNot */
118
140
  function IsNot(value) {
119
141
  return IsKindOf(value, 'Not');
120
142
  }
121
- exports.IsNot = IsNot;
122
143
  /** `[Kind-Only]` Returns true if the given value is TNull */
123
144
  function IsNull(value) {
124
145
  return IsKindOf(value, 'Null');
125
146
  }
126
- exports.IsNull = IsNull;
127
147
  /** `[Kind-Only]` Returns true if the given value is TNumber */
128
148
  function IsNumber(value) {
129
149
  return IsKindOf(value, 'Number');
130
150
  }
131
- exports.IsNumber = IsNumber;
132
151
  /** `[Kind-Only]` Returns true if the given value is TObject */
133
152
  function IsObject(value) {
134
153
  return IsKindOf(value, 'Object');
135
154
  }
136
- exports.IsObject = IsObject;
137
155
  /** `[Kind-Only]` Returns true if the given value is TPromise */
138
156
  function IsPromise(value) {
139
157
  return IsKindOf(value, 'Promise');
140
158
  }
141
- exports.IsPromise = IsPromise;
142
159
  /** `[Kind-Only]` Returns true if the given value is TRecord */
143
160
  function IsRecord(value) {
144
161
  return IsKindOf(value, 'Record');
145
162
  }
146
- exports.IsRecord = IsRecord;
147
163
  /** `[Kind-Only]` Returns true if this value is TRecursive */
148
164
  function IsRecursive(value) {
149
165
  return ValueGuard.IsObject(value) && index_1.Hint in value && value[index_1.Hint] === 'Recursive';
150
166
  }
151
- exports.IsRecursive = IsRecursive;
152
167
  /** `[Kind-Only]` Returns true if the given value is TRef */
153
168
  function IsRef(value) {
154
169
  return IsKindOf(value, 'Ref');
155
170
  }
156
- exports.IsRef = IsRef;
157
171
  /** `[Kind-Only]` Returns true if the given value is TRegExp */
158
172
  function IsRegExp(value) {
159
173
  return IsKindOf(value, 'RegExp');
160
174
  }
161
- exports.IsRegExp = IsRegExp;
162
175
  /** `[Kind-Only]` Returns true if the given value is TString */
163
176
  function IsString(value) {
164
177
  return IsKindOf(value, 'String');
165
178
  }
166
- exports.IsString = IsString;
167
179
  /** `[Kind-Only]` Returns true if the given value is TSymbol */
168
180
  function IsSymbol(value) {
169
181
  return IsKindOf(value, 'Symbol');
170
182
  }
171
- exports.IsSymbol = IsSymbol;
172
183
  /** `[Kind-Only]` Returns true if the given value is TTemplateLiteral */
173
184
  function IsTemplateLiteral(value) {
174
185
  return IsKindOf(value, 'TemplateLiteral');
175
186
  }
176
- exports.IsTemplateLiteral = IsTemplateLiteral;
177
187
  /** `[Kind-Only]` Returns true if the given value is TThis */
178
188
  function IsThis(value) {
179
189
  return IsKindOf(value, 'This');
180
190
  }
181
- exports.IsThis = IsThis;
182
191
  /** `[Kind-Only]` Returns true of this value is TTransform */
183
192
  function IsTransform(value) {
184
193
  return ValueGuard.IsObject(value) && index_1.TransformKind in value;
185
194
  }
186
- exports.IsTransform = IsTransform;
187
195
  /** `[Kind-Only]` Returns true if the given value is TTuple */
188
196
  function IsTuple(value) {
189
197
  return IsKindOf(value, 'Tuple');
190
198
  }
191
- exports.IsTuple = IsTuple;
192
199
  /** `[Kind-Only]` Returns true if the given value is TUndefined */
193
200
  function IsUndefined(value) {
194
201
  return IsKindOf(value, 'Undefined');
195
202
  }
196
- exports.IsUndefined = IsUndefined;
197
203
  /** `[Kind-Only]` Returns true if the given value is TUnion */
198
204
  function IsUnion(value) {
199
205
  return IsKindOf(value, 'Union');
200
206
  }
201
- exports.IsUnion = IsUnion;
202
207
  /** `[Kind-Only]` Returns true if the given value is TUint8Array */
203
208
  function IsUint8Array(value) {
204
209
  return IsKindOf(value, 'Uint8Array');
205
210
  }
206
- exports.IsUint8Array = IsUint8Array;
207
211
  /** `[Kind-Only]` Returns true if the given value is TUnknown */
208
212
  function IsUnknown(value) {
209
213
  return IsKindOf(value, 'Unknown');
210
214
  }
211
- exports.IsUnknown = IsUnknown;
212
215
  /** `[Kind-Only]` Returns true if the given value is a raw TUnsafe */
213
216
  function IsUnsafe(value) {
214
217
  return IsKindOf(value, 'Unsafe');
215
218
  }
216
- exports.IsUnsafe = IsUnsafe;
217
219
  /** `[Kind-Only]` Returns true if the given value is TVoid */
218
220
  function IsVoid(value) {
219
221
  return IsKindOf(value, 'Void');
220
222
  }
221
- exports.IsVoid = IsVoid;
222
223
  /** `[Kind-Only]` Returns true if the given value is TKind */
223
224
  function IsKind(value) {
224
225
  return ValueGuard.IsObject(value) && index_1.Kind in value && ValueGuard.IsString(value[index_1.Kind]);
225
226
  }
226
- exports.IsKind = IsKind;
227
227
  /** `[Kind-Only]` Returns true if the given value is TSchema */
228
228
  function IsSchema(value) {
229
229
  // prettier-ignore
@@ -263,4 +263,3 @@ function IsSchema(value) {
263
263
  IsVoid(value) ||
264
264
  IsKind(value));
265
265
  }
266
- exports.IsSchema = IsSchema;
@@ -1,7 +1,54 @@
1
1
  "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.IsSchema = exports.IsKind = exports.IsVoid = exports.IsUnsafe = exports.IsUnknown = exports.IsUint8Array = exports.IsUnion = exports.IsUnionLiteral = exports.IsUndefined = exports.IsTuple = exports.IsTransform = exports.IsThis = exports.IsTemplateLiteral = exports.IsSymbol = exports.IsString = exports.IsRegExp = exports.IsRef = exports.IsRecursive = exports.IsRecord = exports.IsPromise = exports.IsObject = exports.IsNumber = exports.IsNull = exports.IsNot = exports.IsNever = exports.IsMappedResult = exports.IsMappedKey = exports.IsLiteralValue = exports.IsLiteral = exports.IsLiteralBoolean = exports.IsLiteralNumber = exports.IsLiteralString = exports.IsKindOf = exports.IsIterator = exports.IsIntersect = exports.IsProperties = exports.IsInteger = exports.IsFunction = exports.IsDate = exports.IsConstructor = exports.IsBoolean = exports.IsBigInt = exports.IsAsyncIterator = exports.IsArray = exports.IsAny = exports.IsOptional = exports.IsReadonly = exports.TypeGuardUnknownTypeError = void 0;
4
+ exports.TypeGuardUnknownTypeError = void 0;
5
+ exports.IsReadonly = IsReadonly;
6
+ exports.IsOptional = IsOptional;
7
+ exports.IsAny = IsAny;
8
+ exports.IsArray = IsArray;
9
+ exports.IsAsyncIterator = IsAsyncIterator;
10
+ exports.IsBigInt = IsBigInt;
11
+ exports.IsBoolean = IsBoolean;
12
+ exports.IsConstructor = IsConstructor;
13
+ exports.IsDate = IsDate;
14
+ exports.IsFunction = IsFunction;
15
+ exports.IsInteger = IsInteger;
16
+ exports.IsProperties = IsProperties;
17
+ exports.IsIntersect = IsIntersect;
18
+ exports.IsIterator = IsIterator;
19
+ exports.IsKindOf = IsKindOf;
20
+ exports.IsLiteralString = IsLiteralString;
21
+ exports.IsLiteralNumber = IsLiteralNumber;
22
+ exports.IsLiteralBoolean = IsLiteralBoolean;
23
+ exports.IsLiteral = IsLiteral;
24
+ exports.IsLiteralValue = IsLiteralValue;
25
+ exports.IsMappedKey = IsMappedKey;
26
+ exports.IsMappedResult = IsMappedResult;
27
+ exports.IsNever = IsNever;
28
+ exports.IsNot = IsNot;
29
+ exports.IsNull = IsNull;
30
+ exports.IsNumber = IsNumber;
31
+ exports.IsObject = IsObject;
32
+ exports.IsPromise = IsPromise;
33
+ exports.IsRecord = IsRecord;
34
+ exports.IsRecursive = IsRecursive;
35
+ exports.IsRef = IsRef;
36
+ exports.IsRegExp = IsRegExp;
37
+ exports.IsString = IsString;
38
+ exports.IsSymbol = IsSymbol;
39
+ exports.IsTemplateLiteral = IsTemplateLiteral;
40
+ exports.IsThis = IsThis;
41
+ exports.IsTransform = IsTransform;
42
+ exports.IsTuple = IsTuple;
43
+ exports.IsUndefined = IsUndefined;
44
+ exports.IsUnionLiteral = IsUnionLiteral;
45
+ exports.IsUnion = IsUnion;
46
+ exports.IsUint8Array = IsUint8Array;
47
+ exports.IsUnknown = IsUnknown;
48
+ exports.IsUnsafe = IsUnsafe;
49
+ exports.IsVoid = IsVoid;
50
+ exports.IsKind = IsKind;
51
+ exports.IsSchema = IsSchema;
5
52
  const ValueGuard = require("./value");
6
53
  const index_1 = require("../symbols/index");
7
54
  const index_2 = require("../error/index");
@@ -94,12 +141,10 @@ function IsOptionalSchema(value) {
94
141
  function IsReadonly(value) {
95
142
  return ValueGuard.IsObject(value) && value[index_1.ReadonlyKind] === 'Readonly';
96
143
  }
97
- exports.IsReadonly = IsReadonly;
98
144
  /** Returns true if this value has a Optional symbol */
99
145
  function IsOptional(value) {
100
146
  return ValueGuard.IsObject(value) && value[index_1.OptionalKind] === 'Optional';
101
147
  }
102
- exports.IsOptional = IsOptional;
103
148
  // ------------------------------------------------------------------
104
149
  // Types
105
150
  // ------------------------------------------------------------------
@@ -109,7 +154,6 @@ function IsAny(value) {
109
154
  return (IsKindOf(value, 'Any') &&
110
155
  IsOptionalString(value.$id));
111
156
  }
112
- exports.IsAny = IsAny;
113
157
  /** Returns true if the given value is TArray */
114
158
  function IsArray(value) {
115
159
  return (IsKindOf(value, 'Array') &&
@@ -123,7 +167,6 @@ function IsArray(value) {
123
167
  IsOptionalNumber(value.minContains) &&
124
168
  IsOptionalNumber(value.maxContains));
125
169
  }
126
- exports.IsArray = IsArray;
127
170
  /** Returns true if the given value is TAsyncIterator */
128
171
  function IsAsyncIterator(value) {
129
172
  // prettier-ignore
@@ -132,7 +175,6 @@ function IsAsyncIterator(value) {
132
175
  IsOptionalString(value.$id) &&
133
176
  IsSchema(value.items));
134
177
  }
135
- exports.IsAsyncIterator = IsAsyncIterator;
136
178
  /** Returns true if the given value is TBigInt */
137
179
  function IsBigInt(value) {
138
180
  // prettier-ignore
@@ -145,7 +187,6 @@ function IsBigInt(value) {
145
187
  IsOptionalBigInt(value.minimum) &&
146
188
  IsOptionalBigInt(value.multipleOf));
147
189
  }
148
- exports.IsBigInt = IsBigInt;
149
190
  /** Returns true if the given value is TBoolean */
150
191
  function IsBoolean(value) {
151
192
  // prettier-ignore
@@ -153,7 +194,6 @@ function IsBoolean(value) {
153
194
  value.type === 'boolean' &&
154
195
  IsOptionalString(value.$id));
155
196
  }
156
- exports.IsBoolean = IsBoolean;
157
197
  /** Returns true if the given value is TConstructor */
158
198
  function IsConstructor(value) {
159
199
  // prettier-ignore
@@ -164,7 +204,6 @@ function IsConstructor(value) {
164
204
  value.parameters.every(schema => IsSchema(schema)) &&
165
205
  IsSchema(value.returns));
166
206
  }
167
- exports.IsConstructor = IsConstructor;
168
207
  /** Returns true if the given value is TDate */
169
208
  function IsDate(value) {
170
209
  return (IsKindOf(value, 'Date') &&
@@ -176,7 +215,6 @@ function IsDate(value) {
176
215
  IsOptionalNumber(value.minimumTimestamp) &&
177
216
  IsOptionalNumber(value.multipleOfTimestamp));
178
217
  }
179
- exports.IsDate = IsDate;
180
218
  /** Returns true if the given value is TFunction */
181
219
  function IsFunction(value) {
182
220
  // prettier-ignore
@@ -187,7 +225,6 @@ function IsFunction(value) {
187
225
  value.parameters.every(schema => IsSchema(schema)) &&
188
226
  IsSchema(value.returns));
189
227
  }
190
- exports.IsFunction = IsFunction;
191
228
  /** Returns true if the given value is TInteger */
192
229
  function IsInteger(value) {
193
230
  return (IsKindOf(value, 'Integer') &&
@@ -199,14 +236,12 @@ function IsInteger(value) {
199
236
  IsOptionalNumber(value.minimum) &&
200
237
  IsOptionalNumber(value.multipleOf));
201
238
  }
202
- exports.IsInteger = IsInteger;
203
239
  /** Returns true if the given schema is TProperties */
204
240
  function IsProperties(value) {
205
241
  // prettier-ignore
206
242
  return (ValueGuard.IsObject(value) &&
207
243
  Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema(schema)));
208
244
  }
209
- exports.IsProperties = IsProperties;
210
245
  /** Returns true if the given value is TIntersect */
211
246
  function IsIntersect(value) {
212
247
  // prettier-ignore
@@ -218,7 +253,6 @@ function IsIntersect(value) {
218
253
  (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) &&
219
254
  IsOptionalString(value.$id));
220
255
  }
221
- exports.IsIntersect = IsIntersect;
222
256
  /** Returns true if the given value is TIterator */
223
257
  function IsIterator(value) {
224
258
  // prettier-ignore
@@ -227,39 +261,32 @@ function IsIterator(value) {
227
261
  IsOptionalString(value.$id) &&
228
262
  IsSchema(value.items));
229
263
  }
230
- exports.IsIterator = IsIterator;
231
264
  /** Returns true if the given value is a TKind with the given name. */
232
265
  function IsKindOf(value, kind) {
233
266
  return ValueGuard.IsObject(value) && index_1.Kind in value && value[index_1.Kind] === kind;
234
267
  }
235
- exports.IsKindOf = IsKindOf;
236
268
  /** Returns true if the given value is TLiteral<string> */
237
269
  function IsLiteralString(value) {
238
270
  return IsLiteral(value) && ValueGuard.IsString(value.const);
239
271
  }
240
- exports.IsLiteralString = IsLiteralString;
241
272
  /** Returns true if the given value is TLiteral<number> */
242
273
  function IsLiteralNumber(value) {
243
274
  return IsLiteral(value) && ValueGuard.IsNumber(value.const);
244
275
  }
245
- exports.IsLiteralNumber = IsLiteralNumber;
246
276
  /** Returns true if the given value is TLiteral<boolean> */
247
277
  function IsLiteralBoolean(value) {
248
278
  return IsLiteral(value) && ValueGuard.IsBoolean(value.const);
249
279
  }
250
- exports.IsLiteralBoolean = IsLiteralBoolean;
251
280
  /** Returns true if the given value is TLiteral */
252
281
  function IsLiteral(value) {
253
282
  // prettier-ignore
254
283
  return (IsKindOf(value, 'Literal') &&
255
284
  IsOptionalString(value.$id) && IsLiteralValue(value.const));
256
285
  }
257
- exports.IsLiteral = IsLiteral;
258
286
  /** Returns true if the given value is a TLiteralValue */
259
287
  function IsLiteralValue(value) {
260
288
  return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value);
261
289
  }
262
- exports.IsLiteralValue = IsLiteralValue;
263
290
  /** Returns true if the given value is a TMappedKey */
264
291
  function IsMappedKey(value) {
265
292
  // prettier-ignore
@@ -267,14 +294,12 @@ function IsMappedKey(value) {
267
294
  ValueGuard.IsArray(value.keys) &&
268
295
  value.keys.every(key => ValueGuard.IsNumber(key) || ValueGuard.IsString(key)));
269
296
  }
270
- exports.IsMappedKey = IsMappedKey;
271
297
  /** Returns true if the given value is TMappedResult */
272
298
  function IsMappedResult(value) {
273
299
  // prettier-ignore
274
300
  return (IsKindOf(value, 'MappedResult') &&
275
301
  IsProperties(value.properties));
276
302
  }
277
- exports.IsMappedResult = IsMappedResult;
278
303
  /** Returns true if the given value is TNever */
279
304
  function IsNever(value) {
280
305
  // prettier-ignore
@@ -282,14 +307,12 @@ function IsNever(value) {
282
307
  ValueGuard.IsObject(value.not) &&
283
308
  Object.getOwnPropertyNames(value.not).length === 0);
284
309
  }
285
- exports.IsNever = IsNever;
286
310
  /** Returns true if the given value is TNot */
287
311
  function IsNot(value) {
288
312
  // prettier-ignore
289
313
  return (IsKindOf(value, 'Not') &&
290
314
  IsSchema(value.not));
291
315
  }
292
- exports.IsNot = IsNot;
293
316
  /** Returns true if the given value is TNull */
294
317
  function IsNull(value) {
295
318
  // prettier-ignore
@@ -297,7 +320,6 @@ function IsNull(value) {
297
320
  value.type === 'null' &&
298
321
  IsOptionalString(value.$id));
299
322
  }
300
- exports.IsNull = IsNull;
301
323
  /** Returns true if the given value is TNumber */
302
324
  function IsNumber(value) {
303
325
  return (IsKindOf(value, 'Number') &&
@@ -309,7 +331,6 @@ function IsNumber(value) {
309
331
  IsOptionalNumber(value.minimum) &&
310
332
  IsOptionalNumber(value.multipleOf));
311
333
  }
312
- exports.IsNumber = IsNumber;
313
334
  /** Returns true if the given value is TObject */
314
335
  function IsObject(value) {
315
336
  // prettier-ignore
@@ -321,7 +342,6 @@ function IsObject(value) {
321
342
  IsOptionalNumber(value.minProperties) &&
322
343
  IsOptionalNumber(value.maxProperties));
323
344
  }
324
- exports.IsObject = IsObject;
325
345
  /** Returns true if the given value is TPromise */
326
346
  function IsPromise(value) {
327
347
  // prettier-ignore
@@ -330,7 +350,6 @@ function IsPromise(value) {
330
350
  IsOptionalString(value.$id) &&
331
351
  IsSchema(value.item));
332
352
  }
333
- exports.IsPromise = IsPromise;
334
353
  /** Returns true if the given value is TRecord */
335
354
  function IsRecord(value) {
336
355
  // prettier-ignore
@@ -347,12 +366,10 @@ function IsRecord(value) {
347
366
  IsSchema(schema.patternProperties[keys[0]]));
348
367
  })(value));
349
368
  }
350
- exports.IsRecord = IsRecord;
351
369
  /** Returns true if this value is TRecursive */
352
370
  function IsRecursive(value) {
353
371
  return ValueGuard.IsObject(value) && index_1.Hint in value && value[index_1.Hint] === 'Recursive';
354
372
  }
355
- exports.IsRecursive = IsRecursive;
356
373
  /** Returns true if the given value is TRef */
357
374
  function IsRef(value) {
358
375
  // prettier-ignore
@@ -360,7 +377,6 @@ function IsRef(value) {
360
377
  IsOptionalString(value.$id) &&
361
378
  ValueGuard.IsString(value.$ref));
362
379
  }
363
- exports.IsRef = IsRef;
364
380
  /** Returns true if the given value is TRegExp */
365
381
  function IsRegExp(value) {
366
382
  // prettier-ignore
@@ -371,7 +387,6 @@ function IsRegExp(value) {
371
387
  IsOptionalNumber(value.maxLength) &&
372
388
  IsOptionalNumber(value.minLength));
373
389
  }
374
- exports.IsRegExp = IsRegExp;
375
390
  /** Returns true if the given value is TString */
376
391
  function IsString(value) {
377
392
  // prettier-ignore
@@ -383,7 +398,6 @@ function IsString(value) {
383
398
  IsOptionalPattern(value.pattern) &&
384
399
  IsOptionalFormat(value.format));
385
400
  }
386
- exports.IsString = IsString;
387
401
  /** Returns true if the given value is TSymbol */
388
402
  function IsSymbol(value) {
389
403
  // prettier-ignore
@@ -391,7 +405,6 @@ function IsSymbol(value) {
391
405
  value.type === 'symbol' &&
392
406
  IsOptionalString(value.$id));
393
407
  }
394
- exports.IsSymbol = IsSymbol;
395
408
  /** Returns true if the given value is TTemplateLiteral */
396
409
  function IsTemplateLiteral(value) {
397
410
  // prettier-ignore
@@ -401,7 +414,6 @@ function IsTemplateLiteral(value) {
401
414
  value.pattern[0] === '^' &&
402
415
  value.pattern[value.pattern.length - 1] === '$');
403
416
  }
404
- exports.IsTemplateLiteral = IsTemplateLiteral;
405
417
  /** Returns true if the given value is TThis */
406
418
  function IsThis(value) {
407
419
  // prettier-ignore
@@ -409,12 +421,10 @@ function IsThis(value) {
409
421
  IsOptionalString(value.$id) &&
410
422
  ValueGuard.IsString(value.$ref));
411
423
  }
412
- exports.IsThis = IsThis;
413
424
  /** Returns true of this value is TTransform */
414
425
  function IsTransform(value) {
415
426
  return ValueGuard.IsObject(value) && index_1.TransformKind in value;
416
427
  }
417
- exports.IsTransform = IsTransform;
418
428
  /** Returns true if the given value is TTuple */
419
429
  function IsTuple(value) {
420
430
  // prettier-ignore
@@ -430,7 +440,6 @@ function IsTuple(value) {
430
440
  value.minItems === 0) || (ValueGuard.IsArray(value.items) &&
431
441
  value.items.every(schema => IsSchema(schema)))));
432
442
  }
433
- exports.IsTuple = IsTuple;
434
443
  /** Returns true if the given value is TUndefined */
435
444
  function IsUndefined(value) {
436
445
  // prettier-ignore
@@ -438,12 +447,10 @@ function IsUndefined(value) {
438
447
  value.type === 'undefined' &&
439
448
  IsOptionalString(value.$id));
440
449
  }
441
- exports.IsUndefined = IsUndefined;
442
450
  /** Returns true if the given value is TUnion<Literal<string | number>[]> */
443
451
  function IsUnionLiteral(value) {
444
452
  return IsUnion(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
445
453
  }
446
- exports.IsUnionLiteral = IsUnionLiteral;
447
454
  /** Returns true if the given value is TUnion */
448
455
  function IsUnion(value) {
449
456
  // prettier-ignore
@@ -453,7 +460,6 @@ function IsUnion(value) {
453
460
  ValueGuard.IsArray(value.anyOf) &&
454
461
  value.anyOf.every(schema => IsSchema(schema)));
455
462
  }
456
- exports.IsUnion = IsUnion;
457
463
  /** Returns true if the given value is TUint8Array */
458
464
  function IsUint8Array(value) {
459
465
  // prettier-ignore
@@ -463,19 +469,16 @@ function IsUint8Array(value) {
463
469
  IsOptionalNumber(value.minByteLength) &&
464
470
  IsOptionalNumber(value.maxByteLength));
465
471
  }
466
- exports.IsUint8Array = IsUint8Array;
467
472
  /** Returns true if the given value is TUnknown */
468
473
  function IsUnknown(value) {
469
474
  // prettier-ignore
470
475
  return (IsKindOf(value, 'Unknown') &&
471
476
  IsOptionalString(value.$id));
472
477
  }
473
- exports.IsUnknown = IsUnknown;
474
478
  /** Returns true if the given value is a raw TUnsafe */
475
479
  function IsUnsafe(value) {
476
480
  return IsKindOf(value, 'Unsafe');
477
481
  }
478
- exports.IsUnsafe = IsUnsafe;
479
482
  /** Returns true if the given value is TVoid */
480
483
  function IsVoid(value) {
481
484
  // prettier-ignore
@@ -483,12 +486,10 @@ function IsVoid(value) {
483
486
  value.type === 'void' &&
484
487
  IsOptionalString(value.$id));
485
488
  }
486
- exports.IsVoid = IsVoid;
487
489
  /** Returns true if the given value is TKind */
488
490
  function IsKind(value) {
489
491
  return ValueGuard.IsObject(value) && index_1.Kind in value && ValueGuard.IsString(value[index_1.Kind]) && !KnownTypes.includes(value[index_1.Kind]);
490
492
  }
491
- exports.IsKind = IsKind;
492
493
  /** Returns true if the given value is TSchema */
493
494
  function IsSchema(value) {
494
495
  // prettier-ignore
@@ -528,4 +529,3 @@ function IsSchema(value) {
528
529
  IsVoid(value) ||
529
530
  IsKind(value));
530
531
  }
531
- exports.IsSchema = IsSchema;