typebox 1.3.5 → 1.3.7
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/guard/string.mjs
CHANGED
|
@@ -5,6 +5,18 @@ function IsBetween(value, min, max) {
|
|
|
5
5
|
return value >= min && value <= max;
|
|
6
6
|
}
|
|
7
7
|
// --------------------------------------------------------------------------
|
|
8
|
+
// IsZeroWidthJoiner
|
|
9
|
+
// --------------------------------------------------------------------------
|
|
10
|
+
function IsZeroWidthJoiner(value) {
|
|
11
|
+
return (value === 0x200D);
|
|
12
|
+
}
|
|
13
|
+
// --------------------------------------------------------------------------
|
|
14
|
+
// IsHighSurrogate
|
|
15
|
+
// --------------------------------------------------------------------------
|
|
16
|
+
function IsHighSurrogate(value) {
|
|
17
|
+
return IsBetween(value, 0xD800, 0xDBFF);
|
|
18
|
+
}
|
|
19
|
+
// --------------------------------------------------------------------------
|
|
8
20
|
// IsRegionalIndicator
|
|
9
21
|
// --------------------------------------------------------------------------
|
|
10
22
|
function IsRegionalIndicator(value) {
|
|
@@ -72,10 +84,10 @@ function NextGraphemeClusterIndex(value, clusterStart) {
|
|
|
72
84
|
// IsGraphemeCodePoint
|
|
73
85
|
// --------------------------------------------------------------------------
|
|
74
86
|
function IsGraphemeCodePoint(value) {
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
(value
|
|
78
|
-
|
|
87
|
+
return (IsHighSurrogate(value) ||
|
|
88
|
+
IsCombiningMark(value) ||
|
|
89
|
+
IsVariationSelector(value) ||
|
|
90
|
+
IsZeroWidthJoiner(value));
|
|
79
91
|
}
|
|
80
92
|
// --------------------------------------------------------------------------
|
|
81
93
|
// GraphemeCount
|
|
@@ -49,7 +49,7 @@ import { BuildUniqueItems, CheckUniqueItems, ErrorUniqueItems } from './uniqueIt
|
|
|
49
49
|
// ----------------------------------------------------------------
|
|
50
50
|
function HasTypeName(schema, typename) {
|
|
51
51
|
return Schema.IsType(schema) &&
|
|
52
|
-
(G.IsArray(schema.type) && schema.type.
|
|
52
|
+
(G.IsArray(schema.type) && G.IsGreaterThan(schema.type.length, 0) && G.Every(schema.type, 0, type => G.IsEqual(type, typename)) ||
|
|
53
53
|
G.IsEqual(schema.type, typename));
|
|
54
54
|
}
|
|
55
55
|
// ----------------------------------------------------------------
|
|
@@ -3,14 +3,14 @@ import type { TLocalizedValidationError } from '../../error/index.mjs';
|
|
|
3
3
|
/**
|
|
4
4
|
* Performs an exhaustive Check on the specified value and reports any errors found.
|
|
5
5
|
* If no errors are found, an empty array is returned. Unlike Check, this function
|
|
6
|
-
* does not terminate at the first
|
|
6
|
+
* does not terminate at the first occurrence of an error. For best performance, call
|
|
7
7
|
* Check first and call Errors only if Check returns false.
|
|
8
8
|
*/
|
|
9
9
|
export declare function Errors<Type extends TSchema>(type: Type, value: unknown): TLocalizedValidationError[];
|
|
10
10
|
/**
|
|
11
11
|
* Performs an exhaustive Check on the specified value and reports any errors found.
|
|
12
12
|
* If no errors are found, an empty array is returned. Unlike Check, this function
|
|
13
|
-
* does not terminate at the first
|
|
13
|
+
* does not terminate at the first occurrence of an error. For best performance, call
|
|
14
14
|
* Check first and call Errors only if Check returns false.
|
|
15
15
|
*/
|
|
16
16
|
export declare function Errors<Context extends TProperties, Type extends TSchema>(context: Context, type: Type, value: unknown): TLocalizedValidationError[];
|
|
@@ -4,7 +4,7 @@ import { Errors as SchemaErrors, } from '../../schema/index.mjs';
|
|
|
4
4
|
/**
|
|
5
5
|
* Performs an exhaustive Check on the specified value and reports any errors found.
|
|
6
6
|
* If no errors are found, an empty array is returned. Unlike Check, this function
|
|
7
|
-
* does not terminate at the first
|
|
7
|
+
* does not terminate at the first occurrence of an error. For best performance, call
|
|
8
8
|
* Check first and call Errors only if Check returns false.
|
|
9
9
|
*/
|
|
10
10
|
export function Errors(...args) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typebox",
|
|
3
3
|
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.7",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
7
7
|
"jsonschema"
|
|
@@ -16,38 +16,38 @@
|
|
|
16
16
|
"types": "./build/index.d.mts",
|
|
17
17
|
"module": "./build/index.mjs",
|
|
18
18
|
"exports": {
|
|
19
|
-
"./guard": {
|
|
20
|
-
"import": "./build/guard/index.mjs",
|
|
21
|
-
"default": "./build/guard/index.mjs"
|
|
22
|
-
},
|
|
23
|
-
"./system": {
|
|
24
|
-
"import": "./build/system/index.mjs",
|
|
25
|
-
"default": "./build/system/index.mjs"
|
|
26
|
-
},
|
|
27
19
|
"./schema": {
|
|
28
20
|
"import": "./build/schema/index.mjs",
|
|
29
21
|
"default": "./build/schema/index.mjs"
|
|
30
22
|
},
|
|
31
|
-
"./
|
|
32
|
-
"import": "./build/
|
|
33
|
-
"default": "./build/
|
|
23
|
+
"./system": {
|
|
24
|
+
"import": "./build/system/index.mjs",
|
|
25
|
+
"default": "./build/system/index.mjs"
|
|
34
26
|
},
|
|
35
27
|
"./compile": {
|
|
36
28
|
"import": "./build/compile/index.mjs",
|
|
37
29
|
"default": "./build/compile/index.mjs"
|
|
38
30
|
},
|
|
39
|
-
"./type": {
|
|
40
|
-
"import": "./build/type/index.mjs",
|
|
41
|
-
"default": "./build/type/index.mjs"
|
|
42
|
-
},
|
|
43
31
|
"./value": {
|
|
44
32
|
"import": "./build/value/index.mjs",
|
|
45
33
|
"default": "./build/value/index.mjs"
|
|
46
34
|
},
|
|
35
|
+
"./type": {
|
|
36
|
+
"import": "./build/type/index.mjs",
|
|
37
|
+
"default": "./build/type/index.mjs"
|
|
38
|
+
},
|
|
47
39
|
"./error": {
|
|
48
40
|
"import": "./build/error/index.mjs",
|
|
49
41
|
"default": "./build/error/index.mjs"
|
|
50
42
|
},
|
|
43
|
+
"./format": {
|
|
44
|
+
"import": "./build/format/index.mjs",
|
|
45
|
+
"default": "./build/format/index.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./guard": {
|
|
48
|
+
"import": "./build/guard/index.mjs",
|
|
49
|
+
"default": "./build/guard/index.mjs"
|
|
50
|
+
},
|
|
51
51
|
".": {
|
|
52
52
|
"import": "./build/index.mjs",
|
|
53
53
|
"default": "./build/index.mjs"
|
|
@@ -55,30 +55,30 @@
|
|
|
55
55
|
},
|
|
56
56
|
"typesVersions": {
|
|
57
57
|
"*": {
|
|
58
|
-
"guard": [
|
|
59
|
-
"./build/guard/index.d.mts"
|
|
60
|
-
],
|
|
61
|
-
"system": [
|
|
62
|
-
"./build/system/index.d.mts"
|
|
63
|
-
],
|
|
64
58
|
"schema": [
|
|
65
59
|
"./build/schema/index.d.mts"
|
|
66
60
|
],
|
|
67
|
-
"
|
|
68
|
-
"./build/
|
|
61
|
+
"system": [
|
|
62
|
+
"./build/system/index.d.mts"
|
|
69
63
|
],
|
|
70
64
|
"compile": [
|
|
71
65
|
"./build/compile/index.d.mts"
|
|
72
66
|
],
|
|
73
|
-
"type": [
|
|
74
|
-
"./build/type/index.d.mts"
|
|
75
|
-
],
|
|
76
67
|
"value": [
|
|
77
68
|
"./build/value/index.d.mts"
|
|
78
69
|
],
|
|
70
|
+
"type": [
|
|
71
|
+
"./build/type/index.d.mts"
|
|
72
|
+
],
|
|
79
73
|
"error": [
|
|
80
74
|
"./build/error/index.d.mts"
|
|
81
75
|
],
|
|
76
|
+
"format": [
|
|
77
|
+
"./build/format/index.d.mts"
|
|
78
|
+
],
|
|
79
|
+
"guard": [
|
|
80
|
+
"./build/guard/index.d.mts"
|
|
81
|
+
],
|
|
82
82
|
".": [
|
|
83
83
|
"./build/index.d.mts"
|
|
84
84
|
]
|