typebox 1.0.80 → 1.0.81
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.
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Evaluate, IsObject, Options } from '../../type/index.mjs';
|
|
2
|
+
import { Evaluate, Instantiate, IsObject, Options } from '../../type/index.mjs';
|
|
3
3
|
import { Guard } from '../../guard/index.mjs';
|
|
4
4
|
import { FromType } from './from-type.mjs';
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
// EvaluateIntersection
|
|
7
7
|
// ------------------------------------------------------------------
|
|
8
|
-
function EvaluateIntersection(type) {
|
|
8
|
+
function EvaluateIntersection(context, type) {
|
|
9
9
|
// Note: reinterpret unevaluatedProperties as additionalProperties
|
|
10
10
|
const additionalProperties = Guard.HasPropertyKey(type, 'unevaluatedProperties')
|
|
11
11
|
? { additionalProperties: type.unevaluatedProperties }
|
|
12
12
|
: {};
|
|
13
|
-
const
|
|
13
|
+
const instantiated = Instantiate(context, type);
|
|
14
|
+
const evaluated = Evaluate(instantiated);
|
|
14
15
|
return IsObject(evaluated)
|
|
15
16
|
? Options(evaluated, additionalProperties)
|
|
16
17
|
: evaluated;
|
|
@@ -20,6 +21,6 @@ function EvaluateIntersection(type) {
|
|
|
20
21
|
// ------------------------------------------------------------------
|
|
21
22
|
export function FromIntersect(context, type, value) {
|
|
22
23
|
// Note: Evaluate and route back to FromType in evaluated form (likely an Object)
|
|
23
|
-
const evaluated = EvaluateIntersection(type);
|
|
24
|
+
const evaluated = EvaluateIntersection(context, type);
|
|
24
25
|
return FromType(context, evaluated, value);
|
|
25
26
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Evaluate } from '../../type/index.mjs';
|
|
2
|
+
import { Evaluate, Instantiate } from '../../type/index.mjs';
|
|
3
3
|
import { FromType } from './from-type.mjs';
|
|
4
4
|
export function FromIntersect(context, type, value) {
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const instantiated = Instantiate(context, type);
|
|
6
|
+
const evaluated = Evaluate(instantiated);
|
|
7
|
+
return FromType(context, evaluated, value);
|
|
7
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Evaluate } from '../../type/index.mjs';
|
|
2
|
+
import { Evaluate, Instantiate } from '../../type/index.mjs';
|
|
3
3
|
import { FromType } from './from-type.mjs';
|
|
4
4
|
export function FromIntersect(context, type) {
|
|
5
|
-
|
|
5
|
+
const instantiated = Instantiate(context, type);
|
|
6
|
+
const evaluated = Evaluate(instantiated);
|
|
7
|
+
return FromType(context, evaluated);
|
|
6
8
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
// deno-lint-ignore-file
|
|
3
|
-
import { Evaluate } from '../../type/index.mjs';
|
|
3
|
+
import { Evaluate, Instantiate } from '../../type/index.mjs';
|
|
4
4
|
import { FromType } from './from-type.mjs';
|
|
5
5
|
export function FromIntersect(context, type, value) {
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const instantiated = Instantiate(context, type);
|
|
7
|
+
const evaluated = Evaluate(instantiated);
|
|
8
|
+
return FromType(context, evaluated, value);
|
|
8
9
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Evaluate } from '../../type/index.mjs';
|
|
2
|
+
import { Instantiate, Evaluate } from '../../type/index.mjs';
|
|
3
3
|
import { FromType } from './from-type.mjs';
|
|
4
4
|
export function FromIntersect(context, type, value) {
|
|
5
|
-
const
|
|
5
|
+
const instantiated = Instantiate(context, type);
|
|
6
|
+
const evaluated = Evaluate(instantiated);
|
|
6
7
|
return FromType(context, evaluated, value);
|
|
7
8
|
}
|