@sinclair/typebox 0.33.3 → 0.33.4
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/build/cjs/compiler/compiler.d.ts +2 -2
- package/build/cjs/compiler/compiler.js +1 -1
- package/build/cjs/value/assert/assert.d.ts +15 -0
- package/build/cjs/value/assert/assert.js +55 -0
- package/build/cjs/value/assert/index.d.ts +1 -0
- package/build/cjs/value/assert/index.js +18 -0
- package/build/cjs/value/cast/cast.js +1 -1
- package/build/cjs/value/clean/clean.js +6 -6
- package/build/cjs/value/clone/clone.js +21 -11
- package/build/cjs/value/convert/convert.d.ts +2 -2
- package/build/cjs/value/convert/convert.js +15 -18
- package/build/cjs/value/create/create.js +5 -1
- package/build/cjs/value/default/default.js +14 -16
- package/build/cjs/value/equal/equal.js +3 -3
- package/build/cjs/value/hash/hash.js +1 -1
- package/build/cjs/value/index.d.ts +2 -0
- package/build/cjs/value/index.js +2 -0
- package/build/cjs/value/mutate/mutate.js +4 -4
- package/build/cjs/value/parse/index.d.ts +1 -0
- package/build/cjs/value/parse/index.js +18 -0
- package/build/cjs/value/parse/parse.d.ts +6 -0
- package/build/cjs/value/parse/parse.js +29 -0
- package/build/cjs/value/transform/decode.js +8 -4
- package/build/cjs/value/transform/encode.js +9 -5
- package/build/cjs/value/transform/has.js +5 -1
- package/build/cjs/value/value/value.d.ts +10 -2
- package/build/cjs/value/value/value.js +38 -26
- package/build/esm/compiler/compiler.d.mts +2 -2
- package/build/esm/compiler/compiler.mjs +1 -1
- package/build/esm/value/assert/assert.d.mts +15 -0
- package/build/esm/value/assert/assert.mjs +49 -0
- package/build/esm/value/assert/index.d.mts +1 -0
- package/build/esm/value/assert/index.mjs +1 -0
- package/build/esm/value/cast/cast.mjs +2 -2
- package/build/esm/value/clean/clean.mjs +7 -7
- package/build/esm/value/clone/clone.mjs +22 -12
- package/build/esm/value/convert/convert.d.mts +2 -2
- package/build/esm/value/convert/convert.mjs +16 -19
- package/build/esm/value/create/create.mjs +5 -1
- package/build/esm/value/default/default.mjs +14 -16
- package/build/esm/value/equal/equal.mjs +4 -4
- package/build/esm/value/hash/hash.mjs +2 -2
- package/build/esm/value/index.d.mts +2 -0
- package/build/esm/value/index.mjs +2 -0
- package/build/esm/value/mutate/mutate.mjs +5 -5
- package/build/esm/value/parse/index.d.mts +1 -0
- package/build/esm/value/parse/index.mjs +1 -0
- package/build/esm/value/parse/parse.d.mts +6 -0
- package/build/esm/value/parse/parse.mjs +25 -0
- package/build/esm/value/transform/decode.mjs +9 -5
- package/build/esm/value/transform/encode.mjs +10 -6
- package/build/esm/value/transform/has.mjs +5 -1
- package/build/esm/value/value/value.d.mts +10 -2
- package/build/esm/value/value/value.mjs +11 -1
- package/package.json +1 -1
- package/readme.md +114 -130
package/readme.md
CHANGED
|
@@ -74,13 +74,12 @@ License MIT
|
|
|
74
74
|
- [Indexed](#types-indexed)
|
|
75
75
|
- [Mapped](#types-mapped)
|
|
76
76
|
- [Conditional](#types-conditional)
|
|
77
|
-
- [Intrinsic](#types-intrinsic)
|
|
78
77
|
- [Transform](#types-transform)
|
|
79
|
-
- [Rest](#types-rest)
|
|
80
78
|
- [Guard](#types-guard)
|
|
81
79
|
- [Unsafe](#types-unsafe)
|
|
82
80
|
- [Strict](#types-strict)
|
|
83
81
|
- [Values](#values)
|
|
82
|
+
- [Assert](#values-assert)
|
|
84
83
|
- [Create](#values-create)
|
|
85
84
|
- [Clone](#values-clone)
|
|
86
85
|
- [Check](#values-check)
|
|
@@ -90,6 +89,7 @@ License MIT
|
|
|
90
89
|
- [Cast](#values-cast)
|
|
91
90
|
- [Decode](#values-decode)
|
|
92
91
|
- [Encode](#values-decode)
|
|
92
|
+
- [Parse](#values-parse)
|
|
93
93
|
- [Equal](#values-equal)
|
|
94
94
|
- [Hash](#values-hash)
|
|
95
95
|
- [Diff](#values-diff)
|
|
@@ -176,19 +176,17 @@ type T = Static<typeof T> // type T = {
|
|
|
176
176
|
|
|
177
177
|
//--------------------------------------------------------------------------------------------
|
|
178
178
|
//
|
|
179
|
-
// ...
|
|
179
|
+
// ... or use the type to parse JavaScript values.
|
|
180
180
|
//
|
|
181
181
|
//--------------------------------------------------------------------------------------------
|
|
182
182
|
|
|
183
183
|
import { Value } from '@sinclair/typebox/value'
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
}
|
|
185
|
+
const R = Value.Parse(T, value) // const R: {
|
|
186
|
+
// id: string,
|
|
187
|
+
// name: string,
|
|
188
|
+
// timestamp: number
|
|
189
|
+
// }
|
|
192
190
|
```
|
|
193
191
|
|
|
194
192
|
<a name='types'></a>
|
|
@@ -1000,38 +998,6 @@ const C = Type.Exclude( // type C = Exclude<1 | 2 |
|
|
|
1000
998
|
) // ]>
|
|
1001
999
|
```
|
|
1002
1000
|
|
|
1003
|
-
<a name='types-intrinsic'></a>
|
|
1004
|
-
|
|
1005
|
-
### Intrinsic Types
|
|
1006
|
-
|
|
1007
|
-
TypeBox supports the TypeScript intrinsic string manipulation types Uppercase, Lowercase, Capitalize and Uncapitalize. These types can be used to remap Literal, Template Literal and Union of Literal types.
|
|
1008
|
-
|
|
1009
|
-
```typescript
|
|
1010
|
-
// TypeScript
|
|
1011
|
-
type A = Capitalize<'hello'> // type A = 'Hello'
|
|
1012
|
-
|
|
1013
|
-
type B = Capitalize<'hello' | 'world'> // type C = 'Hello' | 'World'
|
|
1014
|
-
|
|
1015
|
-
type C = Capitalize<`hello${1|2|3}`> // type B = 'Hello1' | 'Hello2' | 'Hello3'
|
|
1016
|
-
|
|
1017
|
-
// TypeBox
|
|
1018
|
-
const A = Type.Capitalize(Type.Literal('hello')) // const A: TLiteral<'Hello'>
|
|
1019
|
-
|
|
1020
|
-
const B = Type.Capitalize(Type.Union([ // const B: TUnion<[
|
|
1021
|
-
Type.Literal('hello'), // TLiteral<'Hello'>,
|
|
1022
|
-
Type.Literal('world') // TLiteral<'World'>
|
|
1023
|
-
])) // ]>
|
|
1024
|
-
|
|
1025
|
-
const C = Type.Capitalize( // const C: TTemplateLiteral<[
|
|
1026
|
-
Type.TemplateLiteral('hello${1|2|3}') // TLiteral<'Hello'>,
|
|
1027
|
-
) // TUnion<[
|
|
1028
|
-
// TLiteral<'1'>,
|
|
1029
|
-
// TLiteral<'2'>,
|
|
1030
|
-
// TLiteral<'3'>
|
|
1031
|
-
// ]>
|
|
1032
|
-
// ]>
|
|
1033
|
-
```
|
|
1034
|
-
|
|
1035
1001
|
<a name='types-transform'></a>
|
|
1036
1002
|
|
|
1037
1003
|
### Transform Types
|
|
@@ -1061,26 +1027,6 @@ type E = StaticEncode<typeof T> // type E = Array<number>
|
|
|
1061
1027
|
type T = Static<typeof T> // type T = Array<number>
|
|
1062
1028
|
```
|
|
1063
1029
|
|
|
1064
|
-
<a name='types-rest'></a>
|
|
1065
|
-
|
|
1066
|
-
### Rest Types
|
|
1067
|
-
|
|
1068
|
-
TypeBox provides the Rest type to uniformly extract variadic tuples from Intersect, Union and Tuple types. This type can be useful to remap variadic types into different forms. The following uses Rest to remap a Tuple into a Union.
|
|
1069
|
-
|
|
1070
|
-
```typescript
|
|
1071
|
-
const T = Type.Tuple([ // const T: TTuple<[
|
|
1072
|
-
Type.String(), // TString,
|
|
1073
|
-
Type.Number() // TNumber
|
|
1074
|
-
]) // ]>
|
|
1075
|
-
|
|
1076
|
-
const R = Type.Rest(T) // const R: [TString, TNumber]
|
|
1077
|
-
|
|
1078
|
-
const U = Type.Union(R) // const T: TUnion<[
|
|
1079
|
-
// TString,
|
|
1080
|
-
// TNumber
|
|
1081
|
-
// ]>
|
|
1082
|
-
```
|
|
1083
|
-
|
|
1084
1030
|
<a name='types-unsafe'></a>
|
|
1085
1031
|
|
|
1086
1032
|
### Unsafe Types
|
|
@@ -1171,6 +1117,18 @@ TypeBox provides an optional Value submodule that can be used to perform structu
|
|
|
1171
1117
|
import { Value } from '@sinclair/typebox/value'
|
|
1172
1118
|
```
|
|
1173
1119
|
|
|
1120
|
+
<a name='values-assert'></a>
|
|
1121
|
+
|
|
1122
|
+
### Assert
|
|
1123
|
+
|
|
1124
|
+
Use the Assert function to assert a value is valid.
|
|
1125
|
+
|
|
1126
|
+
```typescript
|
|
1127
|
+
let value: unknown = 1
|
|
1128
|
+
|
|
1129
|
+
Value.Assert(Type.Number(), value) // throws AssertError if invalid
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1174
1132
|
<a name='values-create'></a>
|
|
1175
1133
|
|
|
1176
1134
|
### Create
|
|
@@ -1296,6 +1254,32 @@ const A = Value.Encode(Type.String(), 'hello') // const A = 'hello'
|
|
|
1296
1254
|
const B = Value.Encode(Type.String(), 42) // throw
|
|
1297
1255
|
```
|
|
1298
1256
|
|
|
1257
|
+
<a name='values-parse'></a>
|
|
1258
|
+
|
|
1259
|
+
### Parse
|
|
1260
|
+
|
|
1261
|
+
Use the Parse function to parse a value or throw if invalid. This function internally uses Default, Clean, Convert and Decode to make a best effort attempt to parse the value into the expected type. This function should not be used in performance critical code paths.
|
|
1262
|
+
|
|
1263
|
+
```typescript
|
|
1264
|
+
const T = Type.Object({ x: Type.Number({ default: 0 }), y: Type.Number({ default: 0 }) })
|
|
1265
|
+
|
|
1266
|
+
// Default
|
|
1267
|
+
|
|
1268
|
+
const A = Value.Parse(T, { }) // const A = { x: 0, y: 0 }
|
|
1269
|
+
|
|
1270
|
+
// Convert
|
|
1271
|
+
|
|
1272
|
+
const B = Value.Parse(T, { x: '1', y: '2' }) // const B = { x: 1, y: 2 }
|
|
1273
|
+
|
|
1274
|
+
// Clean
|
|
1275
|
+
|
|
1276
|
+
const C = Value.Parse(T, { x: 1, y: 2, z: 3 }) // const C = { x: 1, y: 2 }
|
|
1277
|
+
|
|
1278
|
+
// Assert
|
|
1279
|
+
|
|
1280
|
+
const D = Value.Parse(T, undefined) // throws AssertError
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1299
1283
|
<a name='values-equal'></a>
|
|
1300
1284
|
|
|
1301
1285
|
### Equal
|
|
@@ -1716,37 +1700,37 @@ This benchmark measures compilation performance for varying types.
|
|
|
1716
1700
|
|
|
1717
1701
|
```typescript
|
|
1718
1702
|
┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┐
|
|
1719
|
-
│
|
|
1703
|
+
│ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │
|
|
1720
1704
|
├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┤
|
|
1721
|
-
│ Literal_String │
|
|
1722
|
-
│ Literal_Number │
|
|
1723
|
-
│ Literal_Boolean │
|
|
1724
|
-
│ Primitive_Number │
|
|
1725
|
-
│ Primitive_String │
|
|
1726
|
-
│ Primitive_String_Pattern │
|
|
1727
|
-
│ Primitive_Boolean │
|
|
1728
|
-
│ Primitive_Null │
|
|
1729
|
-
│ Object_Unconstrained │
|
|
1730
|
-
│ Object_Constrained │
|
|
1731
|
-
│ Object_Vector3 │
|
|
1732
|
-
│ Object_Box3D │
|
|
1733
|
-
│ Tuple_Primitive │
|
|
1734
|
-
│ Tuple_Object │
|
|
1735
|
-
│ Composite_Intersect │
|
|
1736
|
-
│ Composite_Union │
|
|
1737
|
-
│ Math_Vector4 │
|
|
1738
|
-
│ Math_Matrix4 │
|
|
1739
|
-
│ Array_Primitive_Number │
|
|
1740
|
-
│ Array_Primitive_String │
|
|
1741
|
-
│ Array_Primitive_Boolean │
|
|
1742
|
-
│ Array_Object_Unconstrained │
|
|
1743
|
-
│ Array_Object_Constrained │
|
|
1744
|
-
│ Array_Tuple_Primitive │
|
|
1745
|
-
│ Array_Tuple_Object │
|
|
1746
|
-
│ Array_Composite_Intersect │
|
|
1747
|
-
│ Array_Composite_Union │
|
|
1748
|
-
│ Array_Math_Vector4 │
|
|
1749
|
-
│ Array_Math_Matrix4 │
|
|
1705
|
+
│ Literal_String │ 1000 │ ' 211 ms' │ ' 8 ms' │ ' 26.38 x' │
|
|
1706
|
+
│ Literal_Number │ 1000 │ ' 185 ms' │ ' 5 ms' │ ' 37.00 x' │
|
|
1707
|
+
│ Literal_Boolean │ 1000 │ ' 195 ms' │ ' 4 ms' │ ' 48.75 x' │
|
|
1708
|
+
│ Primitive_Number │ 1000 │ ' 149 ms' │ ' 7 ms' │ ' 21.29 x' │
|
|
1709
|
+
│ Primitive_String │ 1000 │ ' 135 ms' │ ' 5 ms' │ ' 27.00 x' │
|
|
1710
|
+
│ Primitive_String_Pattern │ 1000 │ ' 193 ms' │ ' 10 ms' │ ' 19.30 x' │
|
|
1711
|
+
│ Primitive_Boolean │ 1000 │ ' 152 ms' │ ' 4 ms' │ ' 38.00 x' │
|
|
1712
|
+
│ Primitive_Null │ 1000 │ ' 147 ms' │ ' 4 ms' │ ' 36.75 x' │
|
|
1713
|
+
│ Object_Unconstrained │ 1000 │ ' 1065 ms' │ ' 26 ms' │ ' 40.96 x' │
|
|
1714
|
+
│ Object_Constrained │ 1000 │ ' 1183 ms' │ ' 26 ms' │ ' 45.50 x' │
|
|
1715
|
+
│ Object_Vector3 │ 1000 │ ' 407 ms' │ ' 9 ms' │ ' 45.22 x' │
|
|
1716
|
+
│ Object_Box3D │ 1000 │ ' 1777 ms' │ ' 24 ms' │ ' 74.04 x' │
|
|
1717
|
+
│ Tuple_Primitive │ 1000 │ ' 485 ms' │ ' 11 ms' │ ' 44.09 x' │
|
|
1718
|
+
│ Tuple_Object │ 1000 │ ' 1344 ms' │ ' 17 ms' │ ' 79.06 x' │
|
|
1719
|
+
│ Composite_Intersect │ 1000 │ ' 606 ms' │ ' 14 ms' │ ' 43.29 x' │
|
|
1720
|
+
│ Composite_Union │ 1000 │ ' 522 ms' │ ' 17 ms' │ ' 30.71 x' │
|
|
1721
|
+
│ Math_Vector4 │ 1000 │ ' 851 ms' │ ' 9 ms' │ ' 94.56 x' │
|
|
1722
|
+
│ Math_Matrix4 │ 1000 │ ' 406 ms' │ ' 10 ms' │ ' 40.60 x' │
|
|
1723
|
+
│ Array_Primitive_Number │ 1000 │ ' 367 ms' │ ' 6 ms' │ ' 61.17 x' │
|
|
1724
|
+
│ Array_Primitive_String │ 1000 │ ' 339 ms' │ ' 7 ms' │ ' 48.43 x' │
|
|
1725
|
+
│ Array_Primitive_Boolean │ 1000 │ ' 325 ms' │ ' 5 ms' │ ' 65.00 x' │
|
|
1726
|
+
│ Array_Object_Unconstrained │ 1000 │ ' 1863 ms' │ ' 21 ms' │ ' 88.71 x' │
|
|
1727
|
+
│ Array_Object_Constrained │ 1000 │ ' 1535 ms' │ ' 18 ms' │ ' 85.28 x' │
|
|
1728
|
+
│ Array_Tuple_Primitive │ 1000 │ ' 829 ms' │ ' 14 ms' │ ' 59.21 x' │
|
|
1729
|
+
│ Array_Tuple_Object │ 1000 │ ' 1674 ms' │ ' 14 ms' │ ' 119.57 x' │
|
|
1730
|
+
│ Array_Composite_Intersect │ 1000 │ ' 789 ms' │ ' 13 ms' │ ' 60.69 x' │
|
|
1731
|
+
│ Array_Composite_Union │ 1000 │ ' 822 ms' │ ' 15 ms' │ ' 54.80 x' │
|
|
1732
|
+
│ Array_Math_Vector4 │ 1000 │ ' 1129 ms' │ ' 14 ms' │ ' 80.64 x' │
|
|
1733
|
+
│ Array_Math_Matrix4 │ 1000 │ ' 673 ms' │ ' 9 ms' │ ' 74.78 x' │
|
|
1750
1734
|
└────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┘
|
|
1751
1735
|
```
|
|
1752
1736
|
|
|
@@ -1758,39 +1742,39 @@ This benchmark measures validation performance for varying types.
|
|
|
1758
1742
|
|
|
1759
1743
|
```typescript
|
|
1760
1744
|
┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐
|
|
1761
|
-
│
|
|
1745
|
+
│ (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │
|
|
1762
1746
|
├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤
|
|
1763
|
-
│ Literal_String │
|
|
1764
|
-
│ Literal_Number │
|
|
1765
|
-
│ Literal_Boolean │
|
|
1766
|
-
│ Primitive_Number │
|
|
1767
|
-
│ Primitive_String │
|
|
1768
|
-
│ Primitive_String_Pattern │
|
|
1769
|
-
│ Primitive_Boolean │
|
|
1770
|
-
│ Primitive_Null │
|
|
1771
|
-
│ Object_Unconstrained │
|
|
1772
|
-
│ Object_Constrained │
|
|
1773
|
-
│ Object_Vector3 │
|
|
1774
|
-
│ Object_Box3D │
|
|
1775
|
-
│ Object_Recursive │
|
|
1776
|
-
│ Tuple_Primitive │
|
|
1777
|
-
│ Tuple_Object │
|
|
1778
|
-
│ Composite_Intersect │
|
|
1779
|
-
│ Composite_Union │
|
|
1780
|
-
│ Math_Vector4 │
|
|
1781
|
-
│ Math_Matrix4 │
|
|
1782
|
-
│ Array_Primitive_Number │
|
|
1783
|
-
│ Array_Primitive_String │
|
|
1784
|
-
│ Array_Primitive_Boolean │
|
|
1785
|
-
│ Array_Object_Unconstrained │
|
|
1786
|
-
│ Array_Object_Constrained │
|
|
1787
|
-
│ Array_Object_Recursive │
|
|
1788
|
-
│ Array_Tuple_Primitive │
|
|
1789
|
-
│ Array_Tuple_Object │
|
|
1790
|
-
│ Array_Composite_Intersect │
|
|
1791
|
-
│ Array_Composite_Union │
|
|
1792
|
-
│ Array_Math_Vector4 │
|
|
1793
|
-
│ Array_Math_Matrix4 │
|
|
1747
|
+
│ Literal_String │ 1000000 │ ' 17 ms' │ ' 5 ms' │ ' 5 ms' │ ' 1.00 x' │
|
|
1748
|
+
│ Literal_Number │ 1000000 │ ' 14 ms' │ ' 18 ms' │ ' 9 ms' │ ' 2.00 x' │
|
|
1749
|
+
│ Literal_Boolean │ 1000000 │ ' 14 ms' │ ' 20 ms' │ ' 9 ms' │ ' 2.22 x' │
|
|
1750
|
+
│ Primitive_Number │ 1000000 │ ' 17 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │
|
|
1751
|
+
│ Primitive_String │ 1000000 │ ' 17 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │
|
|
1752
|
+
│ Primitive_String_Pattern │ 1000000 │ ' 172 ms' │ ' 46 ms' │ ' 41 ms' │ ' 1.12 x' │
|
|
1753
|
+
│ Primitive_Boolean │ 1000000 │ ' 14 ms' │ ' 19 ms' │ ' 10 ms' │ ' 1.90 x' │
|
|
1754
|
+
│ Primitive_Null │ 1000000 │ ' 16 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │
|
|
1755
|
+
│ Object_Unconstrained │ 1000000 │ ' 437 ms' │ ' 28 ms' │ ' 14 ms' │ ' 2.00 x' │
|
|
1756
|
+
│ Object_Constrained │ 1000000 │ ' 653 ms' │ ' 46 ms' │ ' 37 ms' │ ' 1.24 x' │
|
|
1757
|
+
│ Object_Vector3 │ 1000000 │ ' 201 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │
|
|
1758
|
+
│ Object_Box3D │ 1000000 │ ' 961 ms' │ ' 37 ms' │ ' 19 ms' │ ' 1.95 x' │
|
|
1759
|
+
│ Object_Recursive │ 1000000 │ ' 3715 ms' │ ' 363 ms' │ ' 174 ms' │ ' 2.09 x' │
|
|
1760
|
+
│ Tuple_Primitive │ 1000000 │ ' 107 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │
|
|
1761
|
+
│ Tuple_Object │ 1000000 │ ' 375 ms' │ ' 28 ms' │ ' 15 ms' │ ' 1.87 x' │
|
|
1762
|
+
│ Composite_Intersect │ 1000000 │ ' 377 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │
|
|
1763
|
+
│ Composite_Union │ 1000000 │ ' 337 ms' │ ' 30 ms' │ ' 17 ms' │ ' 1.76 x' │
|
|
1764
|
+
│ Math_Vector4 │ 1000000 │ ' 137 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │
|
|
1765
|
+
│ Math_Matrix4 │ 1000000 │ ' 576 ms' │ ' 37 ms' │ ' 28 ms' │ ' 1.32 x' │
|
|
1766
|
+
│ Array_Primitive_Number │ 1000000 │ ' 145 ms' │ ' 23 ms' │ ' 12 ms' │ ' 1.92 x' │
|
|
1767
|
+
│ Array_Primitive_String │ 1000000 │ ' 152 ms' │ ' 22 ms' │ ' 13 ms' │ ' 1.69 x' │
|
|
1768
|
+
│ Array_Primitive_Boolean │ 1000000 │ ' 131 ms' │ ' 20 ms' │ ' 13 ms' │ ' 1.54 x' │
|
|
1769
|
+
│ Array_Object_Unconstrained │ 1000000 │ ' 2821 ms' │ ' 62 ms' │ ' 45 ms' │ ' 1.38 x' │
|
|
1770
|
+
│ Array_Object_Constrained │ 1000000 │ ' 2958 ms' │ ' 119 ms' │ ' 134 ms' │ ' 0.89 x' │
|
|
1771
|
+
│ Array_Object_Recursive │ 1000000 │ ' 14695 ms' │ ' 1621 ms' │ ' 635 ms' │ ' 2.55 x' │
|
|
1772
|
+
│ Array_Tuple_Primitive │ 1000000 │ ' 478 ms' │ ' 35 ms' │ ' 28 ms' │ ' 1.25 x' │
|
|
1773
|
+
│ Array_Tuple_Object │ 1000000 │ ' 1623 ms' │ ' 63 ms' │ ' 48 ms' │ ' 1.31 x' │
|
|
1774
|
+
│ Array_Composite_Intersect │ 1000000 │ ' 1582 ms' │ ' 43 ms' │ ' 30 ms' │ ' 1.43 x' │
|
|
1775
|
+
│ Array_Composite_Union │ 1000000 │ ' 1331 ms' │ ' 76 ms' │ ' 40 ms' │ ' 1.90 x' │
|
|
1776
|
+
│ Array_Math_Vector4 │ 1000000 │ ' 564 ms' │ ' 38 ms' │ ' 24 ms' │ ' 1.58 x' │
|
|
1777
|
+
│ Array_Math_Matrix4 │ 1000000 │ ' 2382 ms' │ ' 111 ms' │ ' 83 ms' │ ' 1.34 x' │
|
|
1794
1778
|
└────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘
|
|
1795
1779
|
```
|
|
1796
1780
|
|
|
@@ -1802,13 +1786,13 @@ The following table lists esbuild compiled and minified sizes for each TypeBox m
|
|
|
1802
1786
|
|
|
1803
1787
|
```typescript
|
|
1804
1788
|
┌──────────────────────┬────────────┬────────────┬─────────────┐
|
|
1805
|
-
│
|
|
1789
|
+
│ (index) │ Compiled │ Minified │ Compression │
|
|
1806
1790
|
├──────────────────────┼────────────┼────────────┼─────────────┤
|
|
1807
|
-
│ typebox/compiler │ '
|
|
1808
|
-
│ typebox/errors │ '
|
|
1809
|
-
│ typebox/system │ ' 4
|
|
1810
|
-
│ typebox/value │ '
|
|
1811
|
-
│ typebox │ '
|
|
1791
|
+
│ typebox/compiler │ '119.6 kb' │ ' 52.6 kb' │ '2.27 x' │
|
|
1792
|
+
│ typebox/errors │ ' 48.6 kb' │ ' 21.9 kb' │ '2.22 x' │
|
|
1793
|
+
│ typebox/system │ ' 7.4 kb' │ ' 3.2 kb' │ '2.33 x' │
|
|
1794
|
+
│ typebox/value │ '157.8 kb' │ ' 66.6 kb' │ '2.37 x' │
|
|
1795
|
+
│ typebox │ ' 98.3 kb' │ ' 40.9 kb' │ '2.40 x' │
|
|
1812
1796
|
└──────────────────────┴────────────┴────────────┴─────────────┘
|
|
1813
1797
|
```
|
|
1814
1798
|
|