@sinclair/typebox 0.25.12 → 0.25.14
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.
- package/compiler/compiler.js +2 -2
- package/errors/errors.js +3 -3
- package/guard/guard.js +1 -1
- package/package.json +1 -1
- package/readme.md +69 -69
- package/value/cast.js +1 -1
- package/value/check.js +3 -3
- package/value/create.js +24 -4
package/compiler/compiler.js
CHANGED
|
@@ -108,7 +108,7 @@ exports.TypeCompilerUnknownTypeError = TypeCompilerUnknownTypeError;
|
|
|
108
108
|
var TypeCompiler;
|
|
109
109
|
(function (TypeCompiler) {
|
|
110
110
|
function IsNumber(value) {
|
|
111
|
-
return typeof value === 'number';
|
|
111
|
+
return typeof value === 'number' && !globalThis.isNaN(value);
|
|
112
112
|
}
|
|
113
113
|
// -------------------------------------------------------------------
|
|
114
114
|
// Types
|
|
@@ -174,7 +174,7 @@ var TypeCompiler;
|
|
|
174
174
|
yield `(${value} === null)`;
|
|
175
175
|
}
|
|
176
176
|
function* Number(schema, value) {
|
|
177
|
-
yield `(typeof ${value} === 'number')`;
|
|
177
|
+
yield `(typeof ${value} === 'number' && !isNaN(${value}))`;
|
|
178
178
|
if (IsNumber(schema.multipleOf))
|
|
179
179
|
yield `(${value} % ${schema.multipleOf} === 0)`;
|
|
180
180
|
if (IsNumber(schema.exclusiveMinimum))
|
package/errors/errors.js
CHANGED
|
@@ -101,7 +101,7 @@ exports.ValueErrorsUnknownTypeError = ValueErrorsUnknownTypeError;
|
|
|
101
101
|
var ValueErrors;
|
|
102
102
|
(function (ValueErrors) {
|
|
103
103
|
function IsNumber(value) {
|
|
104
|
-
return typeof value === 'number';
|
|
104
|
+
return typeof value === 'number' && !isNaN(value);
|
|
105
105
|
}
|
|
106
106
|
function* Any(schema, references, path, value) { }
|
|
107
107
|
function* Array(schema, references, path, value) {
|
|
@@ -161,7 +161,7 @@ var ValueErrors;
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
function* Integer(schema, references, path, value) {
|
|
164
|
-
if (!(typeof value === 'number')) {
|
|
164
|
+
if (!(typeof value === 'number' && globalThis.Number.isInteger(value))) {
|
|
165
165
|
return yield { type: ValueErrorType.Number, schema, path, value, message: `Expected number` };
|
|
166
166
|
}
|
|
167
167
|
if (!globalThis.Number.isInteger(value)) {
|
|
@@ -198,7 +198,7 @@ var ValueErrors;
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
function* Number(schema, references, path, value) {
|
|
201
|
-
if (!(typeof value === 'number')) {
|
|
201
|
+
if (!(typeof value === 'number' && !isNaN(value))) {
|
|
202
202
|
return yield { type: ValueErrorType.Number, schema, path, value, message: `Expected number` };
|
|
203
203
|
}
|
|
204
204
|
if (IsNumber(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
package/guard/guard.js
CHANGED
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -73,8 +73,8 @@ License MIT
|
|
|
73
73
|
- [Overview](#overview)
|
|
74
74
|
- [Example](#Example)
|
|
75
75
|
- [Types](#types)
|
|
76
|
-
- [Standard
|
|
77
|
-
- [Extended
|
|
76
|
+
- [Standard](#types-standard)
|
|
77
|
+
- [Extended](#types-extended)
|
|
78
78
|
- [Modifiers](#types-modifiers)
|
|
79
79
|
- [Options](#types-options)
|
|
80
80
|
- [Reference](#types-reference)
|
|
@@ -189,7 +189,7 @@ TypeBox provides a set of functions that allow you to compose JSON Schema simila
|
|
|
189
189
|
|
|
190
190
|
<a name='types-standard'></a>
|
|
191
191
|
|
|
192
|
-
### Standard
|
|
192
|
+
### Standard
|
|
193
193
|
|
|
194
194
|
The following table lists the Standard TypeBox types.
|
|
195
195
|
|
|
@@ -396,7 +396,7 @@ The following table lists the Standard TypeBox types.
|
|
|
396
396
|
|
|
397
397
|
<a name='types-extended'></a>
|
|
398
398
|
|
|
399
|
-
### Extended
|
|
399
|
+
### Extended
|
|
400
400
|
|
|
401
401
|
TypeBox provides a set of extended types that can be used to express schematics for core JavaScript constructs and primitives. Extended types are not valid JSON Schema and will not validate using typical validation. These types however can be used to frame JSON schema and describe callable RPC interfaces that may receive JSON validated data.
|
|
402
402
|
|
|
@@ -1143,27 +1143,28 @@ The custom module is an optional import.
|
|
|
1143
1143
|
import { Custom } from '@sinclair/typebox/custom'
|
|
1144
1144
|
```
|
|
1145
1145
|
|
|
1146
|
-
The following creates a `
|
|
1146
|
+
The following creates a `bigint` type.
|
|
1147
1147
|
|
|
1148
1148
|
```typescript
|
|
1149
1149
|
import { Type, Kind } from '@sinclair/typebox'
|
|
1150
1150
|
|
|
1151
|
-
Custom.Set('
|
|
1151
|
+
Custom.Set('bigint', (schema, value) => typeof value === 'bigint')
|
|
1152
|
+
// ▲
|
|
1152
1153
|
// │
|
|
1153
|
-
// └────────────────────────────┐
|
|
1154
|
+
// └────────────────────────────┐
|
|
1154
1155
|
// │
|
|
1155
|
-
const T = Type.Unsafe<bigint>({ [Kind]: '
|
|
1156
|
+
const T = Type.Unsafe<bigint>({ [Kind]: 'bigint' }) // const T = { [Kind]: 'BigInt' }
|
|
1156
1157
|
|
|
1157
|
-
const A = TypeCompiler.Compile(T).Check(
|
|
1158
|
+
const A = TypeCompiler.Compile(T).Check(1n) // const A = true
|
|
1158
1159
|
|
|
1159
|
-
const B = Value.Check(T,
|
|
1160
|
+
const B = Value.Check(T, 1) // const B = false
|
|
1160
1161
|
```
|
|
1161
1162
|
|
|
1162
1163
|
<a name='typecheck-custom-formats'></a>
|
|
1163
1164
|
|
|
1164
1165
|
### Custom Formats
|
|
1165
1166
|
|
|
1166
|
-
Use the format module to create user defined string formats. If using Ajv, please refer to the official Ajv format documentation located [here](https://ajv.js.org/guide/formats.html).
|
|
1167
|
+
Use the format module to create user defined string formats. The format module is specific to TypeBox can only be used with the TypeCompiler and Value modules. If using Ajv, please refer to the official Ajv format documentation located [here](https://ajv.js.org/guide/formats.html).
|
|
1167
1168
|
|
|
1168
1169
|
The format module is an optional import.
|
|
1169
1170
|
|
|
@@ -1171,20 +1172,19 @@ The format module is an optional import.
|
|
|
1171
1172
|
import { Format } from '@sinclair/typebox/format'
|
|
1172
1173
|
```
|
|
1173
1174
|
|
|
1174
|
-
The following creates a
|
|
1175
|
+
The following creates a custom string format that checks for lowercase.
|
|
1175
1176
|
|
|
1176
1177
|
```typescript
|
|
1177
|
-
Format.Set('
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
const T = Type.String({ format: 'palindrome' })
|
|
1178
|
+
Format.Set('lowercase', value => value === value.toLowerCase())
|
|
1179
|
+
// ▲
|
|
1180
|
+
// │
|
|
1181
|
+
// └────────────────────┐
|
|
1182
|
+
// │
|
|
1183
|
+
const T = Type.String({ format: 'lowercase' })
|
|
1184
1184
|
|
|
1185
|
-
const A = TypeCompiler.Compile(T).Check('
|
|
1185
|
+
const A = TypeCompiler.Compile(T).Check('action') // const A = true
|
|
1186
1186
|
|
|
1187
|
-
const B = Value.Check(T, '
|
|
1187
|
+
const B = Value.Check(T, 'Action') // const B = false
|
|
1188
1188
|
```
|
|
1189
1189
|
|
|
1190
1190
|
<a name='benchmark'></a>
|
|
@@ -1205,29 +1205,29 @@ This benchmark measures compilation performance for varying types. You can revie
|
|
|
1205
1205
|
┌──────────────────┬────────────┬──────────────┬──────────────┬──────────────┐
|
|
1206
1206
|
│ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
|
|
1207
1207
|
├──────────────────┼────────────┼──────────────┼──────────────┼──────────────┤
|
|
1208
|
-
│ Number │ 2000 │ '
|
|
1209
|
-
│ String │ 2000 │ '
|
|
1210
|
-
│ Boolean │ 2000 │ '
|
|
1211
|
-
│ Null │ 2000 │ '
|
|
1212
|
-
│ RegEx │ 2000 │ '
|
|
1213
|
-
│ ObjectA │ 2000 │ '
|
|
1214
|
-
│ ObjectB │ 2000 │ '
|
|
1215
|
-
│ Tuple │ 2000 │ '
|
|
1216
|
-
│ Union │ 2000 │ '
|
|
1217
|
-
│ Vector4 │ 2000 │ '
|
|
1218
|
-
│ Matrix4 │ 2000 │ '
|
|
1219
|
-
│ Literal_String │ 2000 │ '
|
|
1220
|
-
│ Literal_Number │ 2000 │ '
|
|
1221
|
-
│ Literal_Boolean │ 2000 │ '
|
|
1222
|
-
│ Array_Number │ 2000 │ '
|
|
1223
|
-
│ Array_String │ 2000 │ '
|
|
1224
|
-
│ Array_Boolean │ 2000 │ '
|
|
1225
|
-
│ Array_ObjectA │ 2000 │ '
|
|
1226
|
-
│ Array_ObjectB │ 2000 │ '
|
|
1227
|
-
│ Array_Tuple │ 2000 │ '
|
|
1228
|
-
│ Array_Union │ 2000 │ '
|
|
1229
|
-
│ Array_Vector4 │ 2000 │ '
|
|
1230
|
-
│ Array_Matrix4 │ 2000 │ '
|
|
1208
|
+
│ Number │ 2000 │ ' 437 ms' │ ' 15 ms' │ ' 29.13 x' │
|
|
1209
|
+
│ String │ 2000 │ ' 332 ms' │ ' 13 ms' │ ' 25.54 x' │
|
|
1210
|
+
│ Boolean │ 2000 │ ' 293 ms' │ ' 12 ms' │ ' 24.42 x' │
|
|
1211
|
+
│ Null │ 2000 │ ' 259 ms' │ ' 9 ms' │ ' 28.78 x' │
|
|
1212
|
+
│ RegEx │ 2000 │ ' 505 ms' │ ' 21 ms' │ ' 24.05 x' │
|
|
1213
|
+
│ ObjectA │ 2000 │ ' 2726 ms' │ ' 53 ms' │ ' 51.43 x' │
|
|
1214
|
+
│ ObjectB │ 2000 │ ' 2835 ms' │ ' 37 ms' │ ' 76.62 x' │
|
|
1215
|
+
│ Tuple │ 2000 │ ' 1239 ms' │ ' 24 ms' │ ' 51.63 x' │
|
|
1216
|
+
│ Union │ 2000 │ ' 1244 ms' │ ' 34 ms' │ ' 36.59 x' │
|
|
1217
|
+
│ Vector4 │ 2000 │ ' 1521 ms' │ ' 21 ms' │ ' 72.43 x' │
|
|
1218
|
+
│ Matrix4 │ 2000 │ ' 836 ms' │ ' 10 ms' │ ' 83.60 x' │
|
|
1219
|
+
│ Literal_String │ 2000 │ ' 333 ms' │ ' 9 ms' │ ' 37.00 x' │
|
|
1220
|
+
│ Literal_Number │ 2000 │ ' 357 ms' │ ' 9 ms' │ ' 39.67 x' │
|
|
1221
|
+
│ Literal_Boolean │ 2000 │ ' 352 ms' │ ' 6 ms' │ ' 58.67 x' │
|
|
1222
|
+
│ Array_Number │ 2000 │ ' 685 ms' │ ' 12 ms' │ ' 57.08 x' │
|
|
1223
|
+
│ Array_String │ 2000 │ ' 720 ms' │ ' 12 ms' │ ' 60.00 x' │
|
|
1224
|
+
│ Array_Boolean │ 2000 │ ' 709 ms' │ ' 8 ms' │ ' 88.63 x' │
|
|
1225
|
+
│ Array_ObjectA │ 2000 │ ' 3590 ms' │ ' 40 ms' │ ' 89.75 x' │
|
|
1226
|
+
│ Array_ObjectB │ 2000 │ ' 3610 ms' │ ' 51 ms' │ ' 70.78 x' │
|
|
1227
|
+
│ Array_Tuple │ 2000 │ ' 2124 ms' │ ' 19 ms' │ ' 111.79 x' │
|
|
1228
|
+
│ Array_Union │ 2000 │ ' 1533 ms' │ ' 21 ms' │ ' 73.00 x' │
|
|
1229
|
+
│ Array_Vector4 │ 2000 │ ' 2278 ms' │ ' 19 ms' │ ' 119.89 x' │
|
|
1230
|
+
│ Array_Matrix4 │ 2000 │ ' 1504 ms' │ ' 20 ms' │ ' 75.20 x' │
|
|
1231
1231
|
└──────────────────┴────────────┴──────────────┴──────────────┴──────────────┘
|
|
1232
1232
|
```
|
|
1233
1233
|
|
|
@@ -1241,31 +1241,31 @@ This benchmark measures validation performance for varying types. You can review
|
|
|
1241
1241
|
┌──────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
|
|
1242
1242
|
│ (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │
|
|
1243
1243
|
├──────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
|
|
1244
|
-
│ Number │ 1000000 │ '
|
|
1245
|
-
│ String │ 1000000 │ '
|
|
1246
|
-
│ Boolean │ 1000000 │ ' 22 ms' │ '
|
|
1247
|
-
│ Null │ 1000000 │ '
|
|
1248
|
-
│ RegEx │ 1000000 │ '
|
|
1249
|
-
│ ObjectA │ 1000000 │ '
|
|
1250
|
-
│ ObjectB │ 1000000 │ '
|
|
1251
|
-
│ Tuple │ 1000000 │ '
|
|
1252
|
-
│ Union │ 1000000 │ '
|
|
1253
|
-
│ Recursive │ 1000000 │ '
|
|
1254
|
-
│ Vector4 │ 1000000 │ '
|
|
1255
|
-
│ Matrix4 │ 1000000 │ '
|
|
1256
|
-
│ Literal_String │ 1000000 │ '
|
|
1257
|
-
│ Literal_Number │ 1000000 │ ' 47 ms' │ '
|
|
1258
|
-
│ Literal_Boolean │ 1000000 │ '
|
|
1259
|
-
│ Array_Number │ 1000000 │ '
|
|
1260
|
-
│ Array_String │ 1000000 │ '
|
|
1261
|
-
│ Array_Boolean │ 1000000 │ '
|
|
1262
|
-
│ Array_ObjectA │ 1000000 │ '
|
|
1263
|
-
│ Array_ObjectB │ 1000000 │ '
|
|
1264
|
-
│ Array_Tuple │ 1000000 │ '
|
|
1265
|
-
│ Array_Union │ 1000000 │ '
|
|
1266
|
-
│ Array_Recursive │ 1000000 │ '
|
|
1267
|
-
│ Array_Vector4 │ 1000000 │ '
|
|
1268
|
-
│ Array_Matrix4 │ 1000000 │ '
|
|
1244
|
+
│ Number │ 1000000 │ ' 29 ms' │ ' 6 ms' │ ' 6 ms' │ ' 1.00 x' │
|
|
1245
|
+
│ String │ 1000000 │ ' 24 ms' │ ' 19 ms' │ ' 11 ms' │ ' 1.73 x' │
|
|
1246
|
+
│ Boolean │ 1000000 │ ' 22 ms' │ ' 20 ms' │ ' 11 ms' │ ' 1.82 x' │
|
|
1247
|
+
│ Null │ 1000000 │ ' 27 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │
|
|
1248
|
+
│ RegEx │ 1000000 │ ' 160 ms' │ ' 52 ms' │ ' 40 ms' │ ' 1.30 x' │
|
|
1249
|
+
│ ObjectA │ 1000000 │ ' 577 ms' │ ' 37 ms' │ ' 26 ms' │ ' 1.42 x' │
|
|
1250
|
+
│ ObjectB │ 1000000 │ ' 990 ms' │ ' 50 ms' │ ' 37 ms' │ ' 1.35 x' │
|
|
1251
|
+
│ Tuple │ 1000000 │ ' 124 ms' │ ' 22 ms' │ ' 17 ms' │ ' 1.29 x' │
|
|
1252
|
+
│ Union │ 1000000 │ ' 318 ms' │ ' 24 ms' │ ' 16 ms' │ ' 1.50 x' │
|
|
1253
|
+
│ Recursive │ 1000000 │ ' 3102 ms' │ ' 408 ms' │ ' 102 ms' │ ' 4.00 x' │
|
|
1254
|
+
│ Vector4 │ 1000000 │ ' 150 ms' │ ' 23 ms' │ ' 13 ms' │ ' 1.77 x' │
|
|
1255
|
+
│ Matrix4 │ 1000000 │ ' 579 ms' │ ' 43 ms' │ ' 27 ms' │ ' 1.59 x' │
|
|
1256
|
+
│ Literal_String │ 1000000 │ ' 50 ms' │ ' 22 ms' │ ' 10 ms' │ ' 2.20 x' │
|
|
1257
|
+
│ Literal_Number │ 1000000 │ ' 47 ms' │ ' 21 ms' │ ' 11 ms' │ ' 1.91 x' │
|
|
1258
|
+
│ Literal_Boolean │ 1000000 │ ' 48 ms' │ ' 20 ms' │ ' 10 ms' │ ' 2.00 x' │
|
|
1259
|
+
│ Array_Number │ 1000000 │ ' 429 ms' │ ' 32 ms' │ ' 20 ms' │ ' 1.60 x' │
|
|
1260
|
+
│ Array_String │ 1000000 │ ' 474 ms' │ ' 33 ms' │ ' 25 ms' │ ' 1.32 x' │
|
|
1261
|
+
│ Array_Boolean │ 1000000 │ ' 447 ms' │ ' 35 ms' │ ' 31 ms' │ ' 1.13 x' │
|
|
1262
|
+
│ Array_ObjectA │ 1000000 │ ' 14098 ms' │ ' 2352 ms' │ ' 2015 ms' │ ' 1.17 x' │
|
|
1263
|
+
│ Array_ObjectB │ 1000000 │ ' 16216 ms' │ ' 2628 ms' │ ' 2511 ms' │ ' 1.05 x' │
|
|
1264
|
+
│ Array_Tuple │ 1000000 │ ' 1749 ms' │ ' 95 ms' │ ' 75 ms' │ ' 1.27 x' │
|
|
1265
|
+
│ Array_Union │ 1000000 │ ' 4712 ms' │ ' 233 ms' │ ' 84 ms' │ ' 2.77 x' │
|
|
1266
|
+
│ Array_Recursive │ 1000000 │ ' 56118 ms' │ ' 7192 ms' │ ' 1180 ms' │ ' 6.09 x' │
|
|
1267
|
+
│ Array_Vector4 │ 1000000 │ ' 2284 ms' │ ' 99 ms' │ ' 50 ms' │ ' 1.98 x' │
|
|
1268
|
+
│ Array_Matrix4 │ 1000000 │ ' 12640 ms' │ ' 412 ms' │ ' 272 ms' │ ' 1.51 x' │
|
|
1269
1269
|
└──────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
|
|
1270
1270
|
```
|
|
1271
1271
|
|
package/value/cast.js
CHANGED
|
@@ -137,7 +137,7 @@ var ValueCast;
|
|
|
137
137
|
return typeof value === 'bigint';
|
|
138
138
|
}
|
|
139
139
|
function IsNumber(value) {
|
|
140
|
-
return typeof value === 'number';
|
|
140
|
+
return typeof value === 'number' && !isNaN(value);
|
|
141
141
|
}
|
|
142
142
|
function IsStringNumeric(value) {
|
|
143
143
|
return IsString(value) && !isNaN(value) && !isNaN(parseFloat(value));
|
package/value/check.js
CHANGED
|
@@ -42,7 +42,7 @@ exports.ValueCheckUnknownTypeError = ValueCheckUnknownTypeError;
|
|
|
42
42
|
var ValueCheck;
|
|
43
43
|
(function (ValueCheck) {
|
|
44
44
|
function IsNumber(value) {
|
|
45
|
-
return typeof value === 'number';
|
|
45
|
+
return typeof value === 'number' && !isNaN(value);
|
|
46
46
|
}
|
|
47
47
|
function Any(schema, references, value) {
|
|
48
48
|
return true;
|
|
@@ -99,7 +99,7 @@ var ValueCheck;
|
|
|
99
99
|
return typeof value === 'function';
|
|
100
100
|
}
|
|
101
101
|
function Integer(schema, references, value) {
|
|
102
|
-
if (!(typeof value === 'number')) {
|
|
102
|
+
if (!(typeof value === 'number' && globalThis.Number.isInteger(value))) {
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
105
105
|
if (!globalThis.Number.isInteger(value)) {
|
|
@@ -132,7 +132,7 @@ var ValueCheck;
|
|
|
132
132
|
return value === null;
|
|
133
133
|
}
|
|
134
134
|
function Number(schema, references, value) {
|
|
135
|
-
if (!(typeof value === 'number')) {
|
|
135
|
+
if (!(typeof value === 'number' && !isNaN(value))) {
|
|
136
136
|
return false;
|
|
137
137
|
}
|
|
138
138
|
if (IsNumber(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
|
package/value/create.js
CHANGED
|
@@ -131,13 +131,23 @@ var ValueCreate;
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
function Literal(schema, references) {
|
|
134
|
-
|
|
134
|
+
if (schema.default !== undefined) {
|
|
135
|
+
return schema.default;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return schema.const;
|
|
139
|
+
}
|
|
135
140
|
}
|
|
136
141
|
function Never(schema, references) {
|
|
137
142
|
throw new ValueCreateNeverTypeError(schema);
|
|
138
143
|
}
|
|
139
144
|
function Null(schema, references) {
|
|
140
|
-
|
|
145
|
+
if (schema.default !== undefined) {
|
|
146
|
+
return schema.default;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
141
151
|
}
|
|
142
152
|
function Number(schema, references) {
|
|
143
153
|
if (schema.default !== undefined) {
|
|
@@ -258,7 +268,12 @@ var ValueCreate;
|
|
|
258
268
|
}
|
|
259
269
|
}
|
|
260
270
|
function Undefined(schema, references) {
|
|
261
|
-
|
|
271
|
+
if (schema.default !== undefined) {
|
|
272
|
+
return schema.default;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
262
277
|
}
|
|
263
278
|
function Union(schema, references) {
|
|
264
279
|
if (schema.default !== undefined) {
|
|
@@ -291,7 +306,12 @@ var ValueCreate;
|
|
|
291
306
|
}
|
|
292
307
|
}
|
|
293
308
|
function Void(schema, references) {
|
|
294
|
-
|
|
309
|
+
if (schema.default !== undefined) {
|
|
310
|
+
return schema.default;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
295
315
|
}
|
|
296
316
|
function UserDefined(schema, references) {
|
|
297
317
|
if (schema.default !== undefined) {
|