@sinclair/typebox 0.32.0-dev-13 → 0.32.0-dev-15

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 (174) hide show
  1. package/build/import/index.d.mts +10 -10
  2. package/build/import/index.mjs +3 -3
  3. package/build/import/type/exclude/exclude-from-mapped-result.d.mts +13 -0
  4. package/build/import/type/exclude/exclude-from-mapped-result.mjs +14 -0
  5. package/build/import/type/exclude/exclude.d.mts +4 -1
  6. package/build/import/type/exclude/exclude.mjs +10 -4
  7. package/build/import/type/exclude/index.d.mts +1 -0
  8. package/build/import/type/exclude/index.mjs +1 -0
  9. package/build/import/type/extends/extends-from-mapped-key.d.mts +17 -0
  10. package/build/import/type/extends/extends-from-mapped-key.mjs +21 -0
  11. package/build/import/type/extends/extends-from-mapped-result.d.mts +13 -0
  12. package/build/import/type/extends/extends-from-mapped-result.mjs +14 -0
  13. package/build/import/type/extends/extends.d.mts +4 -4
  14. package/build/import/type/extends/extends.mjs +4 -4
  15. package/build/import/type/extends/index.d.mts +2 -2
  16. package/build/import/type/extends/index.mjs +2 -2
  17. package/build/import/type/extract/extract-from-mapped-result.d.mts +13 -0
  18. package/build/import/type/extract/extract-from-mapped-result.mjs +14 -0
  19. package/build/import/type/extract/extract.d.mts +3 -0
  20. package/build/import/type/extract/extract.mjs +9 -3
  21. package/build/import/type/extract/index.d.mts +1 -0
  22. package/build/import/type/extract/index.mjs +1 -0
  23. package/build/import/type/guard/type.d.mts +47 -46
  24. package/build/import/type/guard/type.mjs +294 -293
  25. package/build/import/type/indexed/index.d.mts +1 -1
  26. package/build/import/type/indexed/index.mjs +1 -1
  27. package/build/import/type/indexed/{indexed-mapped-result.d.mts → indexed-from-mapped-key.d.mts} +6 -6
  28. package/build/import/type/indexed/indexed-from-mapped-key.mjs +18 -0
  29. package/build/import/type/indexed/indexed-result.d.mts +2 -2
  30. package/build/import/type/indexed/indexed-result.mjs +3 -2
  31. package/build/import/type/indexed/indexed.d.mts +2 -2
  32. package/build/import/type/indexed/indexed.mjs +4 -4
  33. package/build/import/type/intrinsic/capitalize.mjs +1 -2
  34. package/build/import/type/intrinsic/index.d.mts +1 -1
  35. package/build/import/type/intrinsic/index.mjs +1 -1
  36. package/build/import/type/intrinsic/{intrinsic-mapped-result.d.mts → intrinsic-from-mapped-key.d.mts} +6 -5
  37. package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +21 -0
  38. package/build/import/type/intrinsic/intrinsic.d.mts +6 -6
  39. package/build/import/type/intrinsic/intrinsic.mjs +8 -8
  40. package/build/import/type/intrinsic/lowercase.mjs +1 -2
  41. package/build/import/type/intrinsic/uncapitalize.mjs +1 -2
  42. package/build/import/type/intrinsic/uppercase.mjs +1 -2
  43. package/build/import/type/keyof/index.d.mts +1 -0
  44. package/build/import/type/keyof/index.mjs +1 -0
  45. package/build/import/type/keyof/keyof-from-mapped-result.d.mts +13 -0
  46. package/build/import/type/keyof/keyof-from-mapped-result.mjs +14 -0
  47. package/build/import/type/keyof/keyof.d.mts +3 -0
  48. package/build/import/type/keyof/keyof.mjs +9 -2
  49. package/build/import/type/mapped/mapped.d.mts +9 -6
  50. package/build/import/type/mapped/mapped.mjs +11 -4
  51. package/build/import/type/omit/index.d.mts +1 -1
  52. package/build/import/type/omit/index.mjs +1 -1
  53. package/build/import/type/omit/omit-from-mapped-key.d.mts +15 -0
  54. package/build/import/type/omit/omit-from-mapped-key.mjs +20 -0
  55. package/build/import/type/omit/omit.d.mts +2 -2
  56. package/build/import/type/omit/omit.mjs +2 -2
  57. package/build/import/type/partial/index.d.mts +1 -0
  58. package/build/import/type/partial/index.mjs +1 -0
  59. package/build/import/type/partial/partial-from-mapped-result.d.mts +13 -0
  60. package/build/import/type/partial/partial-from-mapped-result.mjs +14 -0
  61. package/build/import/type/partial/partial.d.mts +5 -2
  62. package/build/import/type/partial/partial.mjs +11 -5
  63. package/build/import/type/pick/index.d.mts +1 -1
  64. package/build/import/type/pick/index.mjs +1 -1
  65. package/build/import/type/pick/pick-from-mapped-key.d.mts +15 -0
  66. package/build/import/type/pick/pick-from-mapped-key.mjs +20 -0
  67. package/build/import/type/pick/pick.d.mts +2 -2
  68. package/build/import/type/pick/pick.mjs +2 -2
  69. package/build/import/type/required/index.d.mts +1 -0
  70. package/build/import/type/required/index.mjs +1 -0
  71. package/build/import/type/required/required-from-mapped-result.d.mts +13 -0
  72. package/build/import/type/required/required-from-mapped-result.mjs +14 -0
  73. package/build/import/type/required/required.d.mts +5 -2
  74. package/build/import/type/required/required.mjs +11 -5
  75. package/build/import/type/type/json.d.mts +21 -16
  76. package/build/import/type/type/json.mjs +3 -3
  77. package/build/require/index.d.ts +10 -10
  78. package/build/require/index.js +5 -3
  79. package/build/require/type/exclude/exclude-from-mapped-result.d.ts +13 -0
  80. package/build/require/type/exclude/exclude-from-mapped-result.js +18 -0
  81. package/build/require/type/exclude/exclude.d.ts +4 -1
  82. package/build/require/type/exclude/exclude.js +9 -4
  83. package/build/require/type/exclude/index.d.ts +1 -0
  84. package/build/require/type/exclude/index.js +1 -0
  85. package/build/require/type/extends/extends-from-mapped-key.d.ts +17 -0
  86. package/build/require/type/extends/extends-from-mapped-key.js +25 -0
  87. package/build/require/type/extends/extends-from-mapped-result.d.ts +13 -0
  88. package/build/require/type/extends/extends-from-mapped-result.js +18 -0
  89. package/build/require/type/extends/extends.d.ts +4 -4
  90. package/build/require/type/extends/extends.js +4 -4
  91. package/build/require/type/extends/index.d.ts +2 -2
  92. package/build/require/type/extends/index.js +2 -2
  93. package/build/require/type/extract/extract-from-mapped-result.d.ts +13 -0
  94. package/build/require/type/extract/extract-from-mapped-result.js +18 -0
  95. package/build/require/type/extract/extract.d.ts +3 -0
  96. package/build/require/type/extract/extract.js +8 -2
  97. package/build/require/type/extract/index.d.ts +1 -0
  98. package/build/require/type/extract/index.js +1 -0
  99. package/build/require/type/guard/type.d.ts +47 -46
  100. package/build/require/type/guard/type.js +252 -250
  101. package/build/require/type/indexed/index.d.ts +1 -1
  102. package/build/require/type/indexed/index.js +1 -1
  103. package/build/require/type/indexed/{indexed-mapped-result.d.ts → indexed-from-mapped-key.d.ts} +6 -6
  104. package/build/require/type/indexed/indexed-from-mapped-key.js +22 -0
  105. package/build/require/type/indexed/indexed-result.d.ts +2 -2
  106. package/build/require/type/indexed/indexed-result.js +11 -10
  107. package/build/require/type/indexed/indexed.d.ts +2 -2
  108. package/build/require/type/indexed/indexed.js +4 -4
  109. package/build/require/type/intrinsic/capitalize.js +1 -2
  110. package/build/require/type/intrinsic/index.d.ts +1 -1
  111. package/build/require/type/intrinsic/index.js +1 -1
  112. package/build/require/type/intrinsic/{intrinsic-mapped-result.d.ts → intrinsic-from-mapped-key.d.ts} +6 -5
  113. package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +25 -0
  114. package/build/require/type/intrinsic/intrinsic.d.ts +6 -6
  115. package/build/require/type/intrinsic/intrinsic.js +8 -8
  116. package/build/require/type/intrinsic/lowercase.js +1 -2
  117. package/build/require/type/intrinsic/uncapitalize.js +1 -2
  118. package/build/require/type/intrinsic/uppercase.js +1 -2
  119. package/build/require/type/keyof/index.d.ts +1 -0
  120. package/build/require/type/keyof/index.js +1 -0
  121. package/build/require/type/keyof/keyof-from-mapped-result.d.ts +13 -0
  122. package/build/require/type/keyof/keyof-from-mapped-result.js +18 -0
  123. package/build/require/type/keyof/keyof.d.ts +3 -0
  124. package/build/require/type/keyof/keyof.js +9 -2
  125. package/build/require/type/mapped/mapped.d.ts +9 -6
  126. package/build/require/type/mapped/mapped.js +24 -17
  127. package/build/require/type/omit/index.d.ts +1 -1
  128. package/build/require/type/omit/index.js +1 -1
  129. package/build/require/type/omit/omit-from-mapped-key.d.ts +15 -0
  130. package/build/require/type/omit/omit-from-mapped-key.js +24 -0
  131. package/build/require/type/omit/omit.d.ts +2 -2
  132. package/build/require/type/omit/omit.js +2 -2
  133. package/build/require/type/partial/index.d.ts +1 -0
  134. package/build/require/type/partial/index.js +1 -0
  135. package/build/require/type/partial/partial-from-mapped-result.d.ts +13 -0
  136. package/build/require/type/partial/partial-from-mapped-result.js +18 -0
  137. package/build/require/type/partial/partial.d.ts +5 -2
  138. package/build/require/type/partial/partial.js +10 -5
  139. package/build/require/type/pick/index.d.ts +1 -1
  140. package/build/require/type/pick/index.js +1 -1
  141. package/build/require/type/pick/pick-from-mapped-key.d.ts +15 -0
  142. package/build/require/type/pick/pick-from-mapped-key.js +24 -0
  143. package/build/require/type/pick/pick.d.ts +2 -2
  144. package/build/require/type/pick/pick.js +2 -2
  145. package/build/require/type/required/index.d.ts +1 -0
  146. package/build/require/type/required/index.js +1 -0
  147. package/build/require/type/required/required-from-mapped-result.d.ts +13 -0
  148. package/build/require/type/required/required-from-mapped-result.js +18 -0
  149. package/build/require/type/required/required.d.ts +5 -2
  150. package/build/require/type/required/required.js +10 -5
  151. package/build/require/type/type/json.d.ts +21 -16
  152. package/build/require/type/type/json.js +3 -3
  153. package/package.json +1 -1
  154. package/readme.md +79 -91
  155. package/build/import/type/extends/extends-mapped-result-from-result.d.mts +0 -13
  156. package/build/import/type/extends/extends-mapped-result-from-result.mjs +0 -14
  157. package/build/import/type/extends/extends-mapped-result.d.mts +0 -17
  158. package/build/import/type/extends/extends-mapped-result.mjs +0 -21
  159. package/build/import/type/indexed/indexed-mapped-result.mjs +0 -18
  160. package/build/import/type/intrinsic/intrinsic-mapped-result.mjs +0 -21
  161. package/build/import/type/omit/omit-mapped-result.d.mts +0 -15
  162. package/build/import/type/omit/omit-mapped-result.mjs +0 -20
  163. package/build/import/type/pick/pick-mapped-result.d.mts +0 -15
  164. package/build/import/type/pick/pick-mapped-result.mjs +0 -20
  165. package/build/require/type/extends/extends-mapped-result-from-result.d.ts +0 -13
  166. package/build/require/type/extends/extends-mapped-result-from-result.js +0 -18
  167. package/build/require/type/extends/extends-mapped-result.d.ts +0 -17
  168. package/build/require/type/extends/extends-mapped-result.js +0 -25
  169. package/build/require/type/indexed/indexed-mapped-result.js +0 -22
  170. package/build/require/type/intrinsic/intrinsic-mapped-result.js +0 -25
  171. package/build/require/type/omit/omit-mapped-result.d.ts +0 -15
  172. package/build/require/type/omit/omit-mapped-result.js +0 -24
  173. package/build/require/type/pick/pick-mapped-result.d.ts +0 -15
  174. package/build/require/type/pick/pick-mapped-result.js +0 -24
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TSchema = exports.TKind = exports.TVoid = exports.TUnsafe = exports.TUnknown = exports.TUint8Array = exports.TUnion = exports.TUnionLiteral = exports.TUndefined = exports.TTuple = exports.TTransform = exports.TThis = exports.TTemplateLiteral = exports.TSymbol = exports.TString = exports.TRef = exports.TRecursive = exports.TRecord = exports.TPromise = exports.TObject = exports.TNumber = exports.TNull = exports.TNot = exports.TNever = exports.TMappedResult = exports.TMappedKey = exports.TLiteral = exports.TLiteralBoolean = exports.TLiteralNumber = exports.TLiteralString = exports.TKindOf = exports.TIterator = exports.TIntersect = exports.TProperties = exports.TInteger = exports.TFunction = exports.TDate = exports.TConstructor = exports.TBoolean = exports.TBigInt = exports.TAsyncIterator = exports.TArray = exports.TAny = exports.TOptional = exports.TReadonly = exports.TypeGuardUnknownTypeError = void 0;
3
+ exports.TSchema = exports.TKind = exports.TVoid = exports.TUnsafe = exports.TUnknown = exports.TUint8Array = exports.TUnion = exports.TUnionLiteral = exports.TUndefined = exports.TTuple = exports.TTransform = exports.TThis = exports.TTemplateLiteral = exports.TSymbol = exports.TString = exports.TRef = exports.TRecursive = exports.TRecord = exports.TPromise = exports.TObject = exports.TNumber = exports.TNull = exports.TNot = exports.TNever = exports.TMappedResult = exports.TMappedKey = exports.TLiteralValue = exports.TLiteral = exports.TLiteralBoolean = exports.TLiteralNumber = exports.TLiteralString = exports.TKindOf = exports.TIterator = exports.TIntersect = exports.TProperties = exports.TInteger = exports.TFunction = exports.TDate = exports.TConstructor = exports.TBoolean = exports.TBigInt = exports.TAsyncIterator = exports.TArray = exports.TAny = exports.TOptional = exports.TReadonly = exports.TypeGuardUnknownTypeError = void 0;
4
4
  const ValueGuard = require("./value");
5
5
  const index_1 = require("../symbols/index");
6
6
  class TypeGuardUnknownTypeError extends Error {
@@ -84,348 +84,350 @@ function IsOptionalFormat(value) {
84
84
  function IsOptionalSchema(value) {
85
85
  return ValueGuard.IsUndefined(value) || (0, index_2.TSchema)(value);
86
86
  }
87
- function TReadonly(schema) {
88
- return ValueGuard.IsObject(schema) && schema[index_1.ReadonlyKind] === 'Readonly';
87
+ function TReadonly(value) {
88
+ return ValueGuard.IsObject(value) && value[index_1.ReadonlyKind] === 'Readonly';
89
89
  }
90
90
  exports.TReadonly = TReadonly;
91
- function TOptional(schema) {
92
- return ValueGuard.IsObject(schema) && schema[index_1.OptionalKind] === 'Optional';
91
+ function TOptional(value) {
92
+ return ValueGuard.IsObject(value) && value[index_1.OptionalKind] === 'Optional';
93
93
  }
94
94
  exports.TOptional = TOptional;
95
- function TAny(schema) {
96
- return (TKindOf(schema, 'Any') &&
97
- IsOptionalString(schema.$id));
95
+ function TAny(value) {
96
+ return (TKindOf(value, 'Any') &&
97
+ IsOptionalString(value.$id));
98
98
  }
99
99
  exports.TAny = TAny;
100
- function TArray(schema) {
101
- return (TKindOf(schema, 'Array') &&
102
- schema.type === 'array' &&
103
- IsOptionalString(schema.$id) &&
104
- (0, index_2.TSchema)(schema.items) &&
105
- IsOptionalNumber(schema.minItems) &&
106
- IsOptionalNumber(schema.maxItems) &&
107
- IsOptionalBoolean(schema.uniqueItems) &&
108
- IsOptionalSchema(schema.contains) &&
109
- IsOptionalNumber(schema.minContains) &&
110
- IsOptionalNumber(schema.maxContains));
100
+ function TArray(value) {
101
+ return (TKindOf(value, 'Array') &&
102
+ value.type === 'array' &&
103
+ IsOptionalString(value.$id) &&
104
+ (0, index_2.TSchema)(value.items) &&
105
+ IsOptionalNumber(value.minItems) &&
106
+ IsOptionalNumber(value.maxItems) &&
107
+ IsOptionalBoolean(value.uniqueItems) &&
108
+ IsOptionalSchema(value.contains) &&
109
+ IsOptionalNumber(value.minContains) &&
110
+ IsOptionalNumber(value.maxContains));
111
111
  }
112
112
  exports.TArray = TArray;
113
- function TAsyncIterator(schema) {
114
- return (TKindOf(schema, 'AsyncIterator') &&
115
- schema.type === 'AsyncIterator' &&
116
- IsOptionalString(schema.$id) &&
117
- (0, index_2.TSchema)(schema.items));
113
+ function TAsyncIterator(value) {
114
+ return (TKindOf(value, 'AsyncIterator') &&
115
+ value.type === 'AsyncIterator' &&
116
+ IsOptionalString(value.$id) &&
117
+ (0, index_2.TSchema)(value.items));
118
118
  }
119
119
  exports.TAsyncIterator = TAsyncIterator;
120
- function TBigInt(schema) {
121
- return (TKindOf(schema, 'BigInt') &&
122
- schema.type === 'bigint' &&
123
- IsOptionalString(schema.$id) &&
124
- IsOptionalBigInt(schema.exclusiveMaximum) &&
125
- IsOptionalBigInt(schema.exclusiveMinimum) &&
126
- IsOptionalBigInt(schema.maximum) &&
127
- IsOptionalBigInt(schema.minimum) &&
128
- IsOptionalBigInt(schema.multipleOf));
120
+ function TBigInt(value) {
121
+ return (TKindOf(value, 'BigInt') &&
122
+ value.type === 'bigint' &&
123
+ IsOptionalString(value.$id) &&
124
+ IsOptionalBigInt(value.exclusiveMaximum) &&
125
+ IsOptionalBigInt(value.exclusiveMinimum) &&
126
+ IsOptionalBigInt(value.maximum) &&
127
+ IsOptionalBigInt(value.minimum) &&
128
+ IsOptionalBigInt(value.multipleOf));
129
129
  }
130
130
  exports.TBigInt = TBigInt;
131
- function TBoolean(schema) {
132
- return (TKindOf(schema, 'Boolean') &&
133
- schema.type === 'boolean' &&
134
- IsOptionalString(schema.$id));
131
+ function TBoolean(value) {
132
+ return (TKindOf(value, 'Boolean') &&
133
+ value.type === 'boolean' &&
134
+ IsOptionalString(value.$id));
135
135
  }
136
136
  exports.TBoolean = TBoolean;
137
- function TConstructor(schema) {
138
- return (TKindOf(schema, 'Constructor') &&
139
- schema.type === 'Constructor' &&
140
- IsOptionalString(schema.$id) &&
141
- ValueGuard.IsArray(schema.parameters) &&
142
- schema.parameters.every(schema => (0, index_2.TSchema)(schema)) &&
143
- (0, index_2.TSchema)(schema.returns));
137
+ function TConstructor(value) {
138
+ return (TKindOf(value, 'Constructor') &&
139
+ value.type === 'Constructor' &&
140
+ IsOptionalString(value.$id) &&
141
+ ValueGuard.IsArray(value.parameters) &&
142
+ value.parameters.every(schema => (0, index_2.TSchema)(schema)) &&
143
+ (0, index_2.TSchema)(value.returns));
144
144
  }
145
145
  exports.TConstructor = TConstructor;
146
- function TDate(schema) {
147
- return (TKindOf(schema, 'Date') &&
148
- schema.type === 'Date' &&
149
- IsOptionalString(schema.$id) &&
150
- IsOptionalNumber(schema.exclusiveMaximumTimestamp) &&
151
- IsOptionalNumber(schema.exclusiveMinimumTimestamp) &&
152
- IsOptionalNumber(schema.maximumTimestamp) &&
153
- IsOptionalNumber(schema.minimumTimestamp) &&
154
- IsOptionalNumber(schema.multipleOfTimestamp));
146
+ function TDate(value) {
147
+ return (TKindOf(value, 'Date') &&
148
+ value.type === 'Date' &&
149
+ IsOptionalString(value.$id) &&
150
+ IsOptionalNumber(value.exclusiveMaximumTimestamp) &&
151
+ IsOptionalNumber(value.exclusiveMinimumTimestamp) &&
152
+ IsOptionalNumber(value.maximumTimestamp) &&
153
+ IsOptionalNumber(value.minimumTimestamp) &&
154
+ IsOptionalNumber(value.multipleOfTimestamp));
155
155
  }
156
156
  exports.TDate = TDate;
157
- function TFunction(schema) {
158
- return (TKindOf(schema, 'Function') &&
159
- schema.type === 'Function' &&
160
- IsOptionalString(schema.$id) &&
161
- ValueGuard.IsArray(schema.parameters) &&
162
- schema.parameters.every(schema => (0, index_2.TSchema)(schema)) &&
163
- (0, index_2.TSchema)(schema.returns));
157
+ function TFunction(value) {
158
+ return (TKindOf(value, 'Function') &&
159
+ value.type === 'Function' &&
160
+ IsOptionalString(value.$id) &&
161
+ ValueGuard.IsArray(value.parameters) &&
162
+ value.parameters.every(schema => (0, index_2.TSchema)(schema)) &&
163
+ (0, index_2.TSchema)(value.returns));
164
164
  }
165
165
  exports.TFunction = TFunction;
166
- function TInteger(schema) {
167
- return (TKindOf(schema, 'Integer') &&
168
- schema.type === 'integer' &&
169
- IsOptionalString(schema.$id) &&
170
- IsOptionalNumber(schema.exclusiveMaximum) &&
171
- IsOptionalNumber(schema.exclusiveMinimum) &&
172
- IsOptionalNumber(schema.maximum) &&
173
- IsOptionalNumber(schema.minimum) &&
174
- IsOptionalNumber(schema.multipleOf));
166
+ function TInteger(value) {
167
+ return (TKindOf(value, 'Integer') &&
168
+ value.type === 'integer' &&
169
+ IsOptionalString(value.$id) &&
170
+ IsOptionalNumber(value.exclusiveMaximum) &&
171
+ IsOptionalNumber(value.exclusiveMinimum) &&
172
+ IsOptionalNumber(value.maximum) &&
173
+ IsOptionalNumber(value.minimum) &&
174
+ IsOptionalNumber(value.multipleOf));
175
175
  }
176
176
  exports.TInteger = TInteger;
177
- function TProperties(schema) {
178
- return (ValueGuard.IsObject(schema) &&
179
- Object.entries(schema).every(([key, schema]) => IsControlCharacterFree(key) && (0, index_2.TSchema)(schema)));
177
+ function TProperties(value) {
178
+ return (ValueGuard.IsObject(value) &&
179
+ Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && (0, index_2.TSchema)(schema)));
180
180
  }
181
181
  exports.TProperties = TProperties;
182
- function TIntersect(schema) {
183
- return (TKindOf(schema, 'Intersect') &&
184
- (ValueGuard.IsString(schema.type) && schema.type !== 'object' ? false : true) &&
185
- ValueGuard.IsArray(schema.allOf) &&
186
- schema.allOf.every(schema => (0, index_2.TSchema)(schema) && !TTransform(schema)) &&
187
- IsOptionalString(schema.type) &&
188
- (IsOptionalBoolean(schema.unevaluatedProperties) || IsOptionalSchema(schema.unevaluatedProperties)) &&
189
- IsOptionalString(schema.$id));
182
+ function TIntersect(value) {
183
+ return (TKindOf(value, 'Intersect') &&
184
+ (ValueGuard.IsString(value.type) && value.type !== 'object' ? false : true) &&
185
+ ValueGuard.IsArray(value.allOf) &&
186
+ value.allOf.every(schema => (0, index_2.TSchema)(schema) && !TTransform(schema)) &&
187
+ IsOptionalString(value.type) &&
188
+ (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) &&
189
+ IsOptionalString(value.$id));
190
190
  }
191
191
  exports.TIntersect = TIntersect;
192
- function TIterator(schema) {
193
- return (TKindOf(schema, 'Iterator') &&
194
- schema.type === 'Iterator' &&
195
- IsOptionalString(schema.$id) &&
196
- (0, index_2.TSchema)(schema.items));
192
+ function TIterator(value) {
193
+ return (TKindOf(value, 'Iterator') &&
194
+ value.type === 'Iterator' &&
195
+ IsOptionalString(value.$id) &&
196
+ (0, index_2.TSchema)(value.items));
197
197
  }
198
198
  exports.TIterator = TIterator;
199
- function TKindOf(schema, kind) {
200
- return ValueGuard.IsObject(schema) && index_1.Kind in schema && schema[index_1.Kind] === kind;
199
+ function TKindOf(value, kind) {
200
+ return ValueGuard.IsObject(value) && index_1.Kind in value && value[index_1.Kind] === kind;
201
201
  }
202
202
  exports.TKindOf = TKindOf;
203
- function TLiteralString(schema) {
204
- return (0, index_3.TLiteral)(schema) && ValueGuard.IsString(schema.const);
203
+ function TLiteralString(value) {
204
+ return (0, index_3.TLiteral)(value) && ValueGuard.IsString(value.const);
205
205
  }
206
206
  exports.TLiteralString = TLiteralString;
207
- function TLiteralNumber(schema) {
208
- return (0, index_3.TLiteral)(schema) && ValueGuard.IsNumber(schema.const);
207
+ function TLiteralNumber(value) {
208
+ return (0, index_3.TLiteral)(value) && ValueGuard.IsNumber(value.const);
209
209
  }
210
210
  exports.TLiteralNumber = TLiteralNumber;
211
- function TLiteralBoolean(schema) {
212
- return (0, index_3.TLiteral)(schema) && ValueGuard.IsBoolean(schema.const);
211
+ function TLiteralBoolean(value) {
212
+ return (0, index_3.TLiteral)(value) && ValueGuard.IsBoolean(value.const);
213
213
  }
214
214
  exports.TLiteralBoolean = TLiteralBoolean;
215
- function TLiteral(schema) {
216
- return (TKindOf(schema, 'Literal') &&
217
- IsOptionalString(schema.$id) && (ValueGuard.IsBoolean(schema.const) ||
218
- ValueGuard.IsNumber(schema.const) ||
219
- ValueGuard.IsString(schema.const)));
215
+ function TLiteral(value) {
216
+ return (TKindOf(value, 'Literal') &&
217
+ IsOptionalString(value.$id) && (0, index_3.TLiteralValue)(value.const));
220
218
  }
221
219
  exports.TLiteral = TLiteral;
222
- function TMappedKey(schema) {
223
- return (TKindOf(schema, 'MappedKey') &&
224
- ValueGuard.IsArray(schema.keys) &&
225
- schema.keys.every(key => ValueGuard.IsNumber(key) || ValueGuard.IsString(key)));
220
+ function TLiteralValue(value) {
221
+ return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value);
222
+ }
223
+ exports.TLiteralValue = TLiteralValue;
224
+ function TMappedKey(value) {
225
+ return (TKindOf(value, 'MappedKey') &&
226
+ ValueGuard.IsArray(value.keys) &&
227
+ value.keys.every(key => ValueGuard.IsNumber(key) || ValueGuard.IsString(key)));
226
228
  }
227
229
  exports.TMappedKey = TMappedKey;
228
- function TMappedResult(schema) {
229
- return (TKindOf(schema, 'MappedResult') &&
230
- (0, index_4.TProperties)(schema.properties));
230
+ function TMappedResult(value) {
231
+ return (TKindOf(value, 'MappedResult') &&
232
+ (0, index_4.TProperties)(value.properties));
231
233
  }
232
234
  exports.TMappedResult = TMappedResult;
233
- function TNever(schema) {
234
- return (TKindOf(schema, 'Never') &&
235
- ValueGuard.IsObject(schema.not) &&
236
- Object.getOwnPropertyNames(schema.not).length === 0);
235
+ function TNever(value) {
236
+ return (TKindOf(value, 'Never') &&
237
+ ValueGuard.IsObject(value.not) &&
238
+ Object.getOwnPropertyNames(value.not).length === 0);
237
239
  }
238
240
  exports.TNever = TNever;
239
- function TNot(schema) {
240
- return (TKindOf(schema, 'Not') &&
241
- (0, index_2.TSchema)(schema.not));
241
+ function TNot(value) {
242
+ return (TKindOf(value, 'Not') &&
243
+ (0, index_2.TSchema)(value.not));
242
244
  }
243
245
  exports.TNot = TNot;
244
- function TNull(schema) {
245
- return (TKindOf(schema, 'Null') &&
246
- schema.type === 'null' &&
247
- IsOptionalString(schema.$id));
246
+ function TNull(value) {
247
+ return (TKindOf(value, 'Null') &&
248
+ value.type === 'null' &&
249
+ IsOptionalString(value.$id));
248
250
  }
249
251
  exports.TNull = TNull;
250
- function TNumber(schema) {
251
- return (TKindOf(schema, 'Number') &&
252
- schema.type === 'number' &&
253
- IsOptionalString(schema.$id) &&
254
- IsOptionalNumber(schema.exclusiveMaximum) &&
255
- IsOptionalNumber(schema.exclusiveMinimum) &&
256
- IsOptionalNumber(schema.maximum) &&
257
- IsOptionalNumber(schema.minimum) &&
258
- IsOptionalNumber(schema.multipleOf));
252
+ function TNumber(value) {
253
+ return (TKindOf(value, 'Number') &&
254
+ value.type === 'number' &&
255
+ IsOptionalString(value.$id) &&
256
+ IsOptionalNumber(value.exclusiveMaximum) &&
257
+ IsOptionalNumber(value.exclusiveMinimum) &&
258
+ IsOptionalNumber(value.maximum) &&
259
+ IsOptionalNumber(value.minimum) &&
260
+ IsOptionalNumber(value.multipleOf));
259
261
  }
260
262
  exports.TNumber = TNumber;
261
- function TObject(schema) {
262
- return (TKindOf(schema, 'Object') &&
263
- schema.type === 'object' &&
264
- IsOptionalString(schema.$id) &&
265
- (0, index_4.TProperties)(schema.properties) &&
266
- IsAdditionalProperties(schema.additionalProperties) &&
267
- IsOptionalNumber(schema.minProperties) &&
268
- IsOptionalNumber(schema.maxProperties));
263
+ function TObject(value) {
264
+ return (TKindOf(value, 'Object') &&
265
+ value.type === 'object' &&
266
+ IsOptionalString(value.$id) &&
267
+ (0, index_4.TProperties)(value.properties) &&
268
+ IsAdditionalProperties(value.additionalProperties) &&
269
+ IsOptionalNumber(value.minProperties) &&
270
+ IsOptionalNumber(value.maxProperties));
269
271
  }
270
272
  exports.TObject = TObject;
271
- function TPromise(schema) {
272
- return (TKindOf(schema, 'Promise') &&
273
- schema.type === 'Promise' &&
274
- IsOptionalString(schema.$id) &&
275
- (0, index_2.TSchema)(schema.item));
273
+ function TPromise(value) {
274
+ return (TKindOf(value, 'Promise') &&
275
+ value.type === 'Promise' &&
276
+ IsOptionalString(value.$id) &&
277
+ (0, index_2.TSchema)(value.item));
276
278
  }
277
279
  exports.TPromise = TPromise;
278
- function TRecord(schema) {
279
- return (TKindOf(schema, 'Record') &&
280
- schema.type === 'object' &&
281
- IsOptionalString(schema.$id) &&
282
- IsAdditionalProperties(schema.additionalProperties) &&
283
- ValueGuard.IsObject(schema.patternProperties) &&
280
+ function TRecord(value) {
281
+ return (TKindOf(value, 'Record') &&
282
+ value.type === 'object' &&
283
+ IsOptionalString(value.$id) &&
284
+ IsAdditionalProperties(value.additionalProperties) &&
285
+ ValueGuard.IsObject(value.patternProperties) &&
284
286
  ((schema) => {
285
287
  const keys = Object.getOwnPropertyNames(schema.patternProperties);
286
288
  return (keys.length === 1 &&
287
289
  IsPattern(keys[0]) &&
288
290
  ValueGuard.IsObject(schema.patternProperties) &&
289
291
  (0, index_2.TSchema)(schema.patternProperties[keys[0]]));
290
- })(schema));
292
+ })(value));
291
293
  }
292
294
  exports.TRecord = TRecord;
293
- function TRecursive(schema) {
294
- return ValueGuard.IsObject(schema) && index_1.Hint in schema && schema[index_1.Hint] === 'Recursive';
295
+ function TRecursive(value) {
296
+ return ValueGuard.IsObject(value) && index_1.Hint in value && value[index_1.Hint] === 'Recursive';
295
297
  }
296
298
  exports.TRecursive = TRecursive;
297
- function TRef(schema) {
298
- return (TKindOf(schema, 'Ref') &&
299
- IsOptionalString(schema.$id) &&
300
- ValueGuard.IsString(schema.$ref));
299
+ function TRef(value) {
300
+ return (TKindOf(value, 'Ref') &&
301
+ IsOptionalString(value.$id) &&
302
+ ValueGuard.IsString(value.$ref));
301
303
  }
302
304
  exports.TRef = TRef;
303
- function TString(schema) {
304
- return (TKindOf(schema, 'String') &&
305
- schema.type === 'string' &&
306
- IsOptionalString(schema.$id) &&
307
- IsOptionalNumber(schema.minLength) &&
308
- IsOptionalNumber(schema.maxLength) &&
309
- IsOptionalPattern(schema.pattern) &&
310
- IsOptionalFormat(schema.format));
305
+ function TString(value) {
306
+ return (TKindOf(value, 'String') &&
307
+ value.type === 'string' &&
308
+ IsOptionalString(value.$id) &&
309
+ IsOptionalNumber(value.minLength) &&
310
+ IsOptionalNumber(value.maxLength) &&
311
+ IsOptionalPattern(value.pattern) &&
312
+ IsOptionalFormat(value.format));
311
313
  }
312
314
  exports.TString = TString;
313
- function TSymbol(schema) {
314
- return (TKindOf(schema, 'Symbol') &&
315
- schema.type === 'symbol' &&
316
- IsOptionalString(schema.$id));
315
+ function TSymbol(value) {
316
+ return (TKindOf(value, 'Symbol') &&
317
+ value.type === 'symbol' &&
318
+ IsOptionalString(value.$id));
317
319
  }
318
320
  exports.TSymbol = TSymbol;
319
- function TTemplateLiteral(schema) {
320
- return (TKindOf(schema, 'TemplateLiteral') &&
321
- schema.type === 'string' &&
322
- ValueGuard.IsString(schema.pattern) &&
323
- schema.pattern[0] === '^' &&
324
- schema.pattern[schema.pattern.length - 1] === '$');
321
+ function TTemplateLiteral(value) {
322
+ return (TKindOf(value, 'TemplateLiteral') &&
323
+ value.type === 'string' &&
324
+ ValueGuard.IsString(value.pattern) &&
325
+ value.pattern[0] === '^' &&
326
+ value.pattern[value.pattern.length - 1] === '$');
325
327
  }
326
328
  exports.TTemplateLiteral = TTemplateLiteral;
327
- function TThis(schema) {
328
- return (TKindOf(schema, 'This') &&
329
- IsOptionalString(schema.$id) &&
330
- ValueGuard.IsString(schema.$ref));
329
+ function TThis(value) {
330
+ return (TKindOf(value, 'This') &&
331
+ IsOptionalString(value.$id) &&
332
+ ValueGuard.IsString(value.$ref));
331
333
  }
332
334
  exports.TThis = TThis;
333
- function TTransform(schema) {
334
- return ValueGuard.IsObject(schema) && index_1.TransformKind in schema;
335
+ function TTransform(value) {
336
+ return ValueGuard.IsObject(value) && index_1.TransformKind in value;
335
337
  }
336
338
  exports.TTransform = TTransform;
337
- function TTuple(schema) {
338
- return (TKindOf(schema, 'Tuple') &&
339
- schema.type === 'array' &&
340
- IsOptionalString(schema.$id) &&
341
- ValueGuard.IsNumber(schema.minItems) &&
342
- ValueGuard.IsNumber(schema.maxItems) &&
343
- schema.minItems === schema.maxItems &&
344
- ((ValueGuard.IsUndefined(schema.items) &&
345
- ValueGuard.IsUndefined(schema.additionalItems) &&
346
- schema.minItems === 0) || (ValueGuard.IsArray(schema.items) &&
347
- schema.items.every(schema => (0, index_2.TSchema)(schema)))));
339
+ function TTuple(value) {
340
+ return (TKindOf(value, 'Tuple') &&
341
+ value.type === 'array' &&
342
+ IsOptionalString(value.$id) &&
343
+ ValueGuard.IsNumber(value.minItems) &&
344
+ ValueGuard.IsNumber(value.maxItems) &&
345
+ value.minItems === value.maxItems &&
346
+ ((ValueGuard.IsUndefined(value.items) &&
347
+ ValueGuard.IsUndefined(value.additionalItems) &&
348
+ value.minItems === 0) || (ValueGuard.IsArray(value.items) &&
349
+ value.items.every(schema => (0, index_2.TSchema)(schema)))));
348
350
  }
349
351
  exports.TTuple = TTuple;
350
- function TUndefined(schema) {
351
- return (TKindOf(schema, 'Undefined') &&
352
- schema.type === 'undefined' &&
353
- IsOptionalString(schema.$id));
352
+ function TUndefined(value) {
353
+ return (TKindOf(value, 'Undefined') &&
354
+ value.type === 'undefined' &&
355
+ IsOptionalString(value.$id));
354
356
  }
355
357
  exports.TUndefined = TUndefined;
356
- function TUnionLiteral(schema) {
357
- return (0, index_5.TUnion)(schema) && schema.anyOf.every((schema) => TLiteralString(schema) || TLiteralNumber(schema));
358
+ function TUnionLiteral(value) {
359
+ return (0, index_5.TUnion)(value) && value.anyOf.every((schema) => TLiteralString(schema) || TLiteralNumber(schema));
358
360
  }
359
361
  exports.TUnionLiteral = TUnionLiteral;
360
- function TUnion(schema) {
361
- return (TKindOf(schema, 'Union') &&
362
- IsOptionalString(schema.$id) &&
363
- ValueGuard.IsObject(schema) &&
364
- ValueGuard.IsArray(schema.anyOf) &&
365
- schema.anyOf.every(schema => (0, index_2.TSchema)(schema)));
362
+ function TUnion(value) {
363
+ return (TKindOf(value, 'Union') &&
364
+ IsOptionalString(value.$id) &&
365
+ ValueGuard.IsObject(value) &&
366
+ ValueGuard.IsArray(value.anyOf) &&
367
+ value.anyOf.every(schema => (0, index_2.TSchema)(schema)));
366
368
  }
367
369
  exports.TUnion = TUnion;
368
- function TUint8Array(schema) {
369
- return (TKindOf(schema, 'Uint8Array') &&
370
- schema.type === 'Uint8Array' &&
371
- IsOptionalString(schema.$id) &&
372
- IsOptionalNumber(schema.minByteLength) &&
373
- IsOptionalNumber(schema.maxByteLength));
370
+ function TUint8Array(value) {
371
+ return (TKindOf(value, 'Uint8Array') &&
372
+ value.type === 'Uint8Array' &&
373
+ IsOptionalString(value.$id) &&
374
+ IsOptionalNumber(value.minByteLength) &&
375
+ IsOptionalNumber(value.maxByteLength));
374
376
  }
375
377
  exports.TUint8Array = TUint8Array;
376
- function TUnknown(schema) {
377
- return (TKindOf(schema, 'Unknown') &&
378
- IsOptionalString(schema.$id));
378
+ function TUnknown(value) {
379
+ return (TKindOf(value, 'Unknown') &&
380
+ IsOptionalString(value.$id));
379
381
  }
380
382
  exports.TUnknown = TUnknown;
381
- function TUnsafe(schema) {
382
- return TKindOf(schema, 'Unsafe');
383
+ function TUnsafe(value) {
384
+ return TKindOf(value, 'Unsafe');
383
385
  }
384
386
  exports.TUnsafe = TUnsafe;
385
- function TVoid(schema) {
386
- return (TKindOf(schema, 'Void') &&
387
- schema.type === 'void' &&
388
- IsOptionalString(schema.$id));
387
+ function TVoid(value) {
388
+ return (TKindOf(value, 'Void') &&
389
+ value.type === 'void' &&
390
+ IsOptionalString(value.$id));
389
391
  }
390
392
  exports.TVoid = TVoid;
391
- function TKind(schema) {
392
- return ValueGuard.IsObject(schema) && index_1.Kind in schema && ValueGuard.IsString(schema[index_1.Kind]) && !KnownTypes.includes(schema[index_1.Kind]);
393
+ function TKind(value) {
394
+ return ValueGuard.IsObject(value) && index_1.Kind in value && ValueGuard.IsString(value[index_1.Kind]) && !KnownTypes.includes(value[index_1.Kind]);
393
395
  }
394
396
  exports.TKind = TKind;
395
- function TSchema(schema) {
396
- return (ValueGuard.IsObject(schema)) && ((0, index_6.TAny)(schema) ||
397
- (0, index_7.TArray)(schema) ||
398
- (0, index_8.TBoolean)(schema) ||
399
- (0, index_9.TBigInt)(schema) ||
400
- (0, index_10.TAsyncIterator)(schema) ||
401
- (0, index_11.TConstructor)(schema) ||
402
- (0, index_12.TDate)(schema) ||
403
- (0, index_13.TFunction)(schema) ||
404
- (0, index_14.TInteger)(schema) ||
405
- (0, index_15.TIntersect)(schema) ||
406
- (0, index_16.TIterator)(schema) ||
407
- (0, index_3.TLiteral)(schema) ||
408
- (0, index_17.TMappedKey)(schema) ||
409
- (0, index_17.TMappedResult)(schema) ||
410
- (0, index_18.TNever)(schema) ||
411
- (0, index_19.TNot)(schema) ||
412
- (0, index_20.TNull)(schema) ||
413
- (0, index_21.TNumber)(schema) ||
414
- (0, index_4.TObject)(schema) ||
415
- (0, index_22.TPromise)(schema) ||
416
- (0, index_23.TRecord)(schema) ||
417
- (0, index_24.TRef)(schema) ||
418
- (0, index_25.TString)(schema) ||
419
- (0, index_26.TSymbol)(schema) ||
420
- (0, index_27.TTemplateLiteral)(schema) ||
421
- (0, index_28.TThis)(schema) ||
422
- (0, index_29.TTuple)(schema) ||
423
- (0, index_30.TUndefined)(schema) ||
424
- (0, index_5.TUnion)(schema) ||
425
- (0, index_31.TUint8Array)(schema) ||
426
- (0, index_32.TUnknown)(schema) ||
427
- (0, index_33.TUnsafe)(schema) ||
428
- (0, index_34.TVoid)(schema) ||
429
- TKind(schema));
397
+ function TSchema(value) {
398
+ return (ValueGuard.IsObject(value)) && ((0, index_6.TAny)(value) ||
399
+ (0, index_7.TArray)(value) ||
400
+ (0, index_8.TBoolean)(value) ||
401
+ (0, index_9.TBigInt)(value) ||
402
+ (0, index_10.TAsyncIterator)(value) ||
403
+ (0, index_11.TConstructor)(value) ||
404
+ (0, index_12.TDate)(value) ||
405
+ (0, index_13.TFunction)(value) ||
406
+ (0, index_14.TInteger)(value) ||
407
+ (0, index_15.TIntersect)(value) ||
408
+ (0, index_16.TIterator)(value) ||
409
+ (0, index_3.TLiteral)(value) ||
410
+ (0, index_17.TMappedKey)(value) ||
411
+ (0, index_17.TMappedResult)(value) ||
412
+ (0, index_18.TNever)(value) ||
413
+ (0, index_19.TNot)(value) ||
414
+ (0, index_20.TNull)(value) ||
415
+ (0, index_21.TNumber)(value) ||
416
+ (0, index_4.TObject)(value) ||
417
+ (0, index_22.TPromise)(value) ||
418
+ (0, index_23.TRecord)(value) ||
419
+ (0, index_24.TRef)(value) ||
420
+ (0, index_25.TString)(value) ||
421
+ (0, index_26.TSymbol)(value) ||
422
+ (0, index_27.TTemplateLiteral)(value) ||
423
+ (0, index_28.TThis)(value) ||
424
+ (0, index_29.TTuple)(value) ||
425
+ (0, index_30.TUndefined)(value) ||
426
+ (0, index_5.TUnion)(value) ||
427
+ (0, index_31.TUint8Array)(value) ||
428
+ (0, index_32.TUnknown)(value) ||
429
+ (0, index_33.TUnsafe)(value) ||
430
+ (0, index_34.TVoid)(value) ||
431
+ TKind(value));
430
432
  }
431
433
  exports.TSchema = TSchema;
@@ -1,4 +1,4 @@
1
- export * from './indexed-mapped-result';
1
+ export * from './indexed-from-mapped-key';
2
2
  export * from './indexed-property-keys';
3
3
  export * from './indexed-result';
4
4
  export * from './indexed';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./indexed-mapped-result"), exports);
17
+ __exportStar(require("./indexed-from-mapped-key"), exports);
18
18
  __exportStar(require("./indexed-property-keys"), exports);
19
19
  __exportStar(require("./indexed-result"), exports);
20
20
  __exportStar(require("./indexed"), exports);