typesea 0.1.0 → 0.2.0
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/CHANGELOG.md +67 -6
- package/README.md +98 -17
- package/dist/adapters/index.d.ts +50 -8
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +169 -48
- package/dist/aot/index.d.ts +18 -2
- package/dist/aot/index.d.ts.map +1 -1
- package/dist/aot/index.js +93 -14
- package/dist/async/index.d.ts +28 -56
- package/dist/async/index.d.ts.map +1 -1
- package/dist/async/index.js +94 -37
- package/dist/builders/composite.d.ts +37 -6
- package/dist/builders/composite.d.ts.map +1 -1
- package/dist/builders/composite.js +84 -10
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +2 -0
- package/dist/builders/modifier.d.ts +30 -5
- package/dist/builders/modifier.d.ts.map +1 -1
- package/dist/builders/modifier.js +38 -5
- package/dist/builders/object/guard.d.ts +18 -22
- package/dist/builders/object/guard.d.ts.map +1 -1
- package/dist/builders/object/guard.js +26 -26
- package/dist/builders/object/index.d.ts +2 -0
- package/dist/builders/object/index.d.ts.map +1 -1
- package/dist/builders/object/index.js +2 -0
- package/dist/builders/object/schema.d.ts +55 -9
- package/dist/builders/object/schema.d.ts.map +1 -1
- package/dist/builders/object/schema.js +92 -15
- package/dist/builders/object/types.d.ts +5 -31
- package/dist/builders/object/types.d.ts.map +1 -1
- package/dist/builders/object/types.js +2 -0
- package/dist/builders/scalar.d.ts +29 -8
- package/dist/builders/scalar.d.ts.map +1 -1
- package/dist/builders/scalar.js +33 -8
- package/dist/builders/table.d.ts +4 -0
- package/dist/builders/table.d.ts.map +1 -1
- package/dist/builders/table.js +4 -0
- package/dist/builders/types.d.ts +14 -4
- package/dist/builders/types.d.ts.map +1 -1
- package/dist/builders/types.js +2 -0
- package/dist/compile/check-composite.d.ts +22 -1
- package/dist/compile/check-composite.d.ts.map +1 -1
- package/dist/compile/check-composite.js +564 -24
- package/dist/compile/check-scalar.d.ts +78 -0
- package/dist/compile/check-scalar.d.ts.map +1 -1
- package/dist/compile/check-scalar.js +432 -1
- package/dist/compile/check.d.ts +12 -0
- package/dist/compile/check.d.ts.map +1 -1
- package/dist/compile/check.js +37 -0
- package/dist/compile/context.d.ts +47 -9
- package/dist/compile/context.d.ts.map +1 -1
- package/dist/compile/context.js +51 -8
- package/dist/compile/graph-predicate.d.ts +4 -2
- package/dist/compile/graph-predicate.d.ts.map +1 -1
- package/dist/compile/graph-predicate.js +1907 -171
- package/dist/compile/guard.d.ts +15 -24
- package/dist/compile/guard.d.ts.map +1 -1
- package/dist/compile/guard.js +158 -74
- package/dist/compile/index.d.ts +3 -1
- package/dist/compile/index.d.ts.map +1 -1
- package/dist/compile/index.js +2 -0
- package/dist/compile/issue.d.ts +110 -0
- package/dist/compile/issue.d.ts.map +1 -1
- package/dist/compile/issue.js +184 -1
- package/dist/compile/names.d.ts +12 -2
- package/dist/compile/names.d.ts.map +1 -1
- package/dist/compile/names.js +19 -3
- package/dist/compile/predicate.d.ts +24 -0
- package/dist/compile/predicate.d.ts.map +1 -1
- package/dist/compile/predicate.js +131 -5
- package/dist/compile/runtime.d.ts +80 -12
- package/dist/compile/runtime.d.ts.map +1 -1
- package/dist/compile/runtime.js +25 -6
- package/dist/compile/source.d.ts +10 -2
- package/dist/compile/source.d.ts.map +1 -1
- package/dist/compile/source.js +361 -26
- package/dist/compile/types.d.ts +20 -0
- package/dist/compile/types.d.ts.map +1 -1
- package/dist/compile/types.js +2 -0
- package/dist/decoder/index.d.ts +32 -46
- package/dist/decoder/index.d.ts.map +1 -1
- package/dist/decoder/index.js +102 -38
- package/dist/evaluate/check-composite.d.ts +59 -0
- package/dist/evaluate/check-composite.d.ts.map +1 -1
- package/dist/evaluate/check-composite.js +151 -3
- package/dist/evaluate/check-scalar.d.ts +16 -0
- package/dist/evaluate/check-scalar.d.ts.map +1 -1
- package/dist/evaluate/check-scalar.js +32 -0
- package/dist/evaluate/check.d.ts +7 -0
- package/dist/evaluate/check.d.ts.map +1 -1
- package/dist/evaluate/check.js +43 -0
- package/dist/evaluate/index.d.ts +2 -0
- package/dist/evaluate/index.d.ts.map +1 -1
- package/dist/evaluate/index.js +2 -0
- package/dist/evaluate/issue.d.ts +11 -1
- package/dist/evaluate/issue.d.ts.map +1 -1
- package/dist/evaluate/issue.js +15 -1
- package/dist/evaluate/predicate.d.ts +16 -5
- package/dist/evaluate/predicate.d.ts.map +1 -1
- package/dist/evaluate/predicate.js +20 -5
- package/dist/evaluate/shared.d.ts +59 -13
- package/dist/evaluate/shared.d.ts.map +1 -1
- package/dist/evaluate/shared.js +66 -8
- package/dist/evaluate/state.d.ts +35 -13
- package/dist/evaluate/state.d.ts.map +1 -1
- package/dist/evaluate/state.js +35 -2
- package/dist/guard/base.d.ts +79 -29
- package/dist/guard/base.d.ts.map +1 -1
- package/dist/guard/base.js +91 -29
- package/dist/guard/error.d.ts +10 -5
- package/dist/guard/error.d.ts.map +1 -1
- package/dist/guard/error.js +10 -5
- package/dist/guard/index.d.ts +2 -0
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -0
- package/dist/guard/number.d.ts +26 -11
- package/dist/guard/number.d.ts.map +1 -1
- package/dist/guard/number.js +30 -11
- package/dist/guard/props.d.ts +27 -3
- package/dist/guard/props.d.ts.map +1 -1
- package/dist/guard/props.js +27 -3
- package/dist/guard/read.d.ts +62 -9
- package/dist/guard/read.d.ts.map +1 -1
- package/dist/guard/read.js +83 -10
- package/dist/guard/registry.d.ts +12 -2
- package/dist/guard/registry.d.ts.map +1 -1
- package/dist/guard/registry.js +15 -3
- package/dist/guard/string.d.ts +33 -13
- package/dist/guard/string.d.ts.map +1 -1
- package/dist/guard/string.js +37 -13
- package/dist/guard/types.d.ts +92 -40
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/guard/types.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/index.d.ts +42 -6
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +51 -8
- package/dist/ir/builder.d.ts +16 -126
- package/dist/ir/builder.d.ts.map +1 -1
- package/dist/ir/builder.js +77 -137
- package/dist/ir/freeze.d.ts +4 -0
- package/dist/ir/freeze.d.ts.map +1 -1
- package/dist/ir/freeze.js +59 -0
- package/dist/ir/index.d.ts +3 -1
- package/dist/ir/index.d.ts.map +1 -1
- package/dist/ir/index.js +2 -0
- package/dist/ir/regexp.d.ts +2 -0
- package/dist/ir/regexp.d.ts.map +1 -1
- package/dist/ir/regexp.js +2 -0
- package/dist/ir/types.d.ts +90 -55
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/types.js +2 -0
- package/dist/ir/validate.d.ts +8 -1
- package/dist/ir/validate.d.ts.map +1 -1
- package/dist/ir/validate.js +477 -61
- package/dist/issue/index.d.ts +41 -9
- package/dist/issue/index.d.ts.map +1 -1
- package/dist/issue/index.js +61 -11
- package/dist/json-schema/emit-combinator.d.ts +44 -4
- package/dist/json-schema/emit-combinator.d.ts.map +1 -1
- package/dist/json-schema/emit-combinator.js +44 -4
- package/dist/json-schema/emit-composite.d.ts +10 -0
- package/dist/json-schema/emit-composite.d.ts.map +1 -1
- package/dist/json-schema/emit-composite.js +15 -1
- package/dist/json-schema/emit-scalar.d.ts +26 -3
- package/dist/json-schema/emit-scalar.d.ts.map +1 -1
- package/dist/json-schema/emit-scalar.js +70 -9
- package/dist/json-schema/emit-types.d.ts +11 -1
- package/dist/json-schema/emit-types.d.ts.map +1 -1
- package/dist/json-schema/emit-types.js +2 -0
- package/dist/json-schema/emit.d.ts +12 -1
- package/dist/json-schema/emit.d.ts.map +1 -1
- package/dist/json-schema/emit.js +12 -1
- package/dist/json-schema/freeze.d.ts +13 -2
- package/dist/json-schema/freeze.d.ts.map +1 -1
- package/dist/json-schema/freeze.js +41 -8
- package/dist/json-schema/index.d.ts +16 -2
- package/dist/json-schema/index.d.ts.map +1 -1
- package/dist/json-schema/index.js +23 -3
- package/dist/json-schema/issue.d.ts +4 -1
- package/dist/json-schema/issue.d.ts.map +1 -1
- package/dist/json-schema/issue.js +4 -1
- package/dist/json-schema/read.d.ts +24 -3
- package/dist/json-schema/read.d.ts.map +1 -1
- package/dist/json-schema/read.js +59 -12
- package/dist/json-schema/types.d.ts +38 -15
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/json-schema/types.js +2 -0
- package/dist/kind/index.d.ts +15 -28
- package/dist/kind/index.d.ts.map +1 -1
- package/dist/kind/index.js +15 -10
- package/dist/lower/index.d.ts +6 -1
- package/dist/lower/index.d.ts.map +1 -1
- package/dist/lower/index.js +411 -44
- package/dist/message/index.d.ts +46 -10
- package/dist/message/index.d.ts.map +1 -1
- package/dist/message/index.js +88 -17
- package/dist/optimize/algebraic.d.ts +54 -0
- package/dist/optimize/algebraic.d.ts.map +1 -0
- package/dist/optimize/algebraic.js +314 -0
- package/dist/optimize/compact.d.ts +8 -1
- package/dist/optimize/compact.d.ts.map +1 -1
- package/dist/optimize/compact.js +13 -2
- package/dist/optimize/domain.d.ts +16 -0
- package/dist/optimize/domain.d.ts.map +1 -0
- package/dist/optimize/domain.js +615 -0
- package/dist/optimize/fold-boolean.d.ts +17 -2
- package/dist/optimize/fold-boolean.d.ts.map +1 -1
- package/dist/optimize/fold-boolean.js +59 -14
- package/dist/optimize/fold-common.d.ts +43 -8
- package/dist/optimize/fold-common.d.ts.map +1 -1
- package/dist/optimize/fold-common.js +37 -6
- package/dist/optimize/fold-constraints.d.ts +33 -0
- package/dist/optimize/fold-constraints.d.ts.map +1 -0
- package/dist/optimize/fold-constraints.js +484 -0
- package/dist/optimize/fold-scalar.d.ts +98 -13
- package/dist/optimize/fold-scalar.d.ts.map +1 -1
- package/dist/optimize/fold-scalar.js +98 -13
- package/dist/optimize/fold.d.ts +8 -1
- package/dist/optimize/fold.d.ts.map +1 -1
- package/dist/optimize/fold.js +22 -2
- package/dist/optimize/index.d.ts +9 -1
- package/dist/optimize/index.d.ts.map +1 -1
- package/dist/optimize/index.js +18 -3
- package/dist/optimize/map-node.d.ts +3 -1
- package/dist/optimize/map-node.d.ts.map +1 -1
- package/dist/optimize/map-node.js +45 -3
- package/dist/optimize/peephole.d.ts +16 -0
- package/dist/optimize/peephole.d.ts.map +1 -0
- package/dist/optimize/peephole.js +254 -0
- package/dist/optimize/remap.d.ts +2 -0
- package/dist/optimize/remap.d.ts.map +1 -1
- package/dist/optimize/remap.js +2 -0
- package/dist/optimize/rewrite.d.ts +13 -8
- package/dist/optimize/rewrite.d.ts.map +1 -1
- package/dist/optimize/rewrite.js +13 -8
- package/dist/plan/cache.d.ts +9 -3
- package/dist/plan/cache.d.ts.map +1 -1
- package/dist/plan/cache.js +21 -5
- package/dist/plan/index.d.ts +2 -0
- package/dist/plan/index.d.ts.map +1 -1
- package/dist/plan/index.js +2 -0
- package/dist/plan/predicate.d.ts +2 -0
- package/dist/plan/predicate.d.ts.map +1 -1
- package/dist/plan/predicate.js +268 -29
- package/dist/plan/schema-predicate.d.ts +6 -0
- package/dist/plan/schema-predicate.d.ts.map +1 -1
- package/dist/plan/schema-predicate.js +117 -13
- package/dist/plan/types.d.ts +2 -0
- package/dist/plan/types.d.ts.map +1 -1
- package/dist/plan/types.js +2 -0
- package/dist/result/index.d.ts +19 -5
- package/dist/result/index.d.ts.map +1 -1
- package/dist/result/index.js +10 -2
- package/dist/schema/common.d.ts +69 -6
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +104 -10
- package/dist/schema/freeze.d.ts +4 -0
- package/dist/schema/freeze.d.ts.map +1 -1
- package/dist/schema/freeze.js +18 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +3 -0
- package/dist/schema/lazy.d.ts +4 -0
- package/dist/schema/lazy.d.ts.map +1 -1
- package/dist/schema/lazy.js +4 -0
- package/dist/schema/literal.d.ts +7 -1
- package/dist/schema/literal.d.ts.map +1 -1
- package/dist/schema/literal.js +7 -1
- package/dist/schema/types.d.ts +20 -96
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +5 -1
- package/dist/schema/undefined.d.ts +17 -0
- package/dist/schema/undefined.d.ts.map +1 -0
- package/dist/schema/undefined.js +72 -0
- package/dist/schema/validate.d.ts +8 -1
- package/dist/schema/validate.d.ts.map +1 -1
- package/dist/schema/validate.js +146 -55
- package/docs/api.md +57 -0
- package/docs/assets/benchmark-headline.svg +163 -0
- package/docs/engine-notes.md +58 -15
- package/docs/index.html +130 -110
- package/package.json +65 -65
package/dist/guard/base.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file base.ts
|
|
3
3
|
* @brief Base guard implementation.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
4
6
|
*/
|
|
5
7
|
import { SchemaTag } from "../kind/index.js";
|
|
6
8
|
import { checkSchema, isSchema } from "../evaluate/index.js";
|
|
@@ -10,37 +12,62 @@ import { checkRefinementInput, readConstructorSchema, readGuardSchema } from "./
|
|
|
10
12
|
import { defineReadonlyProperty, isStrictTrue } from "./props.js";
|
|
11
13
|
import { registerConstructedGuard } from "./registry.js";
|
|
12
14
|
/**
|
|
13
|
-
* @brief
|
|
14
|
-
* @details
|
|
15
|
-
*
|
|
15
|
+
* @brief Schema-backed guard base.
|
|
16
|
+
* @details Methods accept an unknown receiver on purpose. Public JavaScript can
|
|
17
|
+
* detach or forge methods, so every entry point re-reads the runtime schema
|
|
18
|
+
* before executing validation.
|
|
19
|
+
* @invariant The stored schema is immutable after construction.
|
|
16
20
|
*/
|
|
17
21
|
export class BaseGuard {
|
|
18
22
|
/**
|
|
19
|
-
* @brief
|
|
20
|
-
|
|
23
|
+
* @brief Construct a schema-backed guard.
|
|
24
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
25
|
+
* existing guard instance.
|
|
26
|
+
* @param schema Runtime schema owned by the guard.
|
|
27
|
+
* @post The schema slot is frozen and the receiver is registered for fast checks.
|
|
21
28
|
*/
|
|
22
29
|
constructor(schema) {
|
|
23
30
|
defineReadonlyProperty(this, "schema", readConstructorSchema(schema), true);
|
|
24
31
|
registerConstructedGuard(this);
|
|
25
32
|
if (new.target === BaseGuard) {
|
|
33
|
+
/*
|
|
34
|
+
* Direct BaseGuard instances have no subclass state. Freeze them here
|
|
35
|
+
* so user code cannot mutate the public validation object after setup.
|
|
36
|
+
*/
|
|
26
37
|
Object.freeze(this);
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
/**
|
|
30
|
-
* @brief
|
|
31
|
-
|
|
41
|
+
* @brief Test whether a value satisfies this guard.
|
|
42
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
43
|
+
* existing guard instance.
|
|
44
|
+
* @param value Candidate runtime value.
|
|
45
|
+
* @returns True when the value is accepted by the guard schema.
|
|
46
|
+
*/
|
|
32
47
|
is(value) {
|
|
48
|
+
/*
|
|
49
|
+
* Methods may be detached from their instance in JavaScript. Re-reading
|
|
50
|
+
* the schema from `this` makes receiver forgery fail before validation.
|
|
51
|
+
*/
|
|
33
52
|
return isSchema(readGuardSchema(this, "guard receiver"), value);
|
|
34
53
|
}
|
|
35
54
|
/**
|
|
36
|
-
* @brief
|
|
37
|
-
|
|
55
|
+
* @brief Validate a value and return explicit diagnostics.
|
|
56
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
57
|
+
* existing guard instance.
|
|
58
|
+
* @param value Candidate runtime value.
|
|
59
|
+
* @returns Result carrying the value on success or frozen issues on failure.
|
|
60
|
+
*/
|
|
38
61
|
check(value) {
|
|
39
62
|
return checkSchema(readGuardSchema(this, "guard receiver"), value);
|
|
40
63
|
}
|
|
41
64
|
/**
|
|
42
|
-
* @brief
|
|
43
|
-
|
|
65
|
+
* @brief Validate a value and throw TypeSeaAssertionError on failure.
|
|
66
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
67
|
+
* existing guard instance.
|
|
68
|
+
* @param value Candidate runtime value.
|
|
69
|
+
* @throws TypeSeaAssertionError when validation fails.
|
|
70
|
+
*/
|
|
44
71
|
assert(value) {
|
|
45
72
|
const result = checkSchema(readGuardSchema(this, "guard receiver"), value);
|
|
46
73
|
if (!result.ok) {
|
|
@@ -48,14 +75,20 @@ export class BaseGuard {
|
|
|
48
75
|
}
|
|
49
76
|
}
|
|
50
77
|
/**
|
|
51
|
-
* @brief graph.
|
|
52
|
-
|
|
78
|
+
* @brief Return the optimized validation graph for introspection.
|
|
79
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
80
|
+
* existing guard instance.
|
|
81
|
+
* @returns Sea-of-Nodes graph derived from the guard schema.
|
|
82
|
+
*/
|
|
53
83
|
graph() {
|
|
54
84
|
return makeValidationPlan(readGuardSchema(this, "guard receiver")).graph;
|
|
55
85
|
}
|
|
56
86
|
/**
|
|
57
|
-
* @brief optional.
|
|
58
|
-
|
|
87
|
+
* @brief Mark this guard as optional in object shapes.
|
|
88
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
89
|
+
* existing guard instance.
|
|
90
|
+
* @returns Fresh guard whose runtime value also allows absent object keys.
|
|
91
|
+
*/
|
|
59
92
|
optional() {
|
|
60
93
|
return new BaseGuard({
|
|
61
94
|
tag: SchemaTag.Optional,
|
|
@@ -63,8 +96,11 @@ export class BaseGuard {
|
|
|
63
96
|
});
|
|
64
97
|
}
|
|
65
98
|
/**
|
|
66
|
-
* @brief
|
|
67
|
-
|
|
99
|
+
* @brief Allow the explicit undefined value.
|
|
100
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
101
|
+
* existing guard instance.
|
|
102
|
+
* @returns Fresh guard wrapping this schema in Undefinedable.
|
|
103
|
+
*/
|
|
68
104
|
undefinedable() {
|
|
69
105
|
return new BaseGuard({
|
|
70
106
|
tag: SchemaTag.Undefinedable,
|
|
@@ -72,8 +108,11 @@ export class BaseGuard {
|
|
|
72
108
|
});
|
|
73
109
|
}
|
|
74
110
|
/**
|
|
75
|
-
* @brief
|
|
76
|
-
|
|
111
|
+
* @brief Allow the explicit null value.
|
|
112
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
113
|
+
* existing guard instance.
|
|
114
|
+
* @returns Fresh guard wrapping this schema in Nullable.
|
|
115
|
+
*/
|
|
77
116
|
nullable() {
|
|
78
117
|
return new BaseGuard({
|
|
79
118
|
tag: SchemaTag.Nullable,
|
|
@@ -81,8 +120,11 @@ export class BaseGuard {
|
|
|
81
120
|
});
|
|
82
121
|
}
|
|
83
122
|
/**
|
|
84
|
-
* @brief array.
|
|
85
|
-
|
|
123
|
+
* @brief Build an array guard using this guard as the item schema.
|
|
124
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
125
|
+
* existing guard instance.
|
|
126
|
+
* @returns Fresh array guard.
|
|
127
|
+
*/
|
|
86
128
|
array() {
|
|
87
129
|
return new BaseGuard({
|
|
88
130
|
tag: SchemaTag.Array,
|
|
@@ -90,8 +132,11 @@ export class BaseGuard {
|
|
|
90
132
|
});
|
|
91
133
|
}
|
|
92
134
|
/**
|
|
93
|
-
* @brief brand.
|
|
94
|
-
|
|
135
|
+
* @brief Attach a compile-time brand without changing runtime validation.
|
|
136
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
137
|
+
* existing guard instance.
|
|
138
|
+
* @returns Fresh branded guard with the same runtime schema.
|
|
139
|
+
*/
|
|
95
140
|
brand() {
|
|
96
141
|
return new BaseGuard({
|
|
97
142
|
tag: SchemaTag.Brand,
|
|
@@ -100,20 +145,33 @@ export class BaseGuard {
|
|
|
100
145
|
});
|
|
101
146
|
}
|
|
102
147
|
/**
|
|
103
|
-
* @brief
|
|
104
|
-
|
|
148
|
+
* @brief Append a user refinement predicate after this guard succeeds.
|
|
149
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
150
|
+
* existing guard instance.
|
|
151
|
+
* @param predicate Function that must return the boolean literal true.
|
|
152
|
+
* @param name Diagnostic name for refinement failure.
|
|
153
|
+
* @returns Fresh refined guard.
|
|
154
|
+
*/
|
|
105
155
|
refine(predicate, name) {
|
|
106
156
|
checkRefinementInput(predicate, name);
|
|
107
157
|
return new BaseGuard({
|
|
108
158
|
tag: SchemaTag.Refine,
|
|
109
159
|
inner: readGuardSchema(this, "refine inner"),
|
|
160
|
+
/*
|
|
161
|
+
* The predicate is wrapped so only strict true succeeds. Truthy
|
|
162
|
+
* non-boolean values stay failures, matching the interpreter helper.
|
|
163
|
+
*/
|
|
110
164
|
predicate: (value) => isStrictTrue(predicate(value)),
|
|
111
165
|
name
|
|
112
166
|
});
|
|
113
167
|
}
|
|
114
168
|
/**
|
|
115
|
-
* @brief
|
|
116
|
-
|
|
169
|
+
* @brief Build a union of this guard and another guard.
|
|
170
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
171
|
+
* existing guard instance.
|
|
172
|
+
* @param other Right-hand guard.
|
|
173
|
+
* @returns Fresh union guard preserving both runtime schemas.
|
|
174
|
+
*/
|
|
117
175
|
or(other) {
|
|
118
176
|
return new BaseGuard({
|
|
119
177
|
tag: SchemaTag.Union,
|
|
@@ -124,8 +182,12 @@ export class BaseGuard {
|
|
|
124
182
|
});
|
|
125
183
|
}
|
|
126
184
|
/**
|
|
127
|
-
* @brief
|
|
128
|
-
|
|
185
|
+
* @brief Build an intersection of this guard and another guard.
|
|
186
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
187
|
+
* existing guard instance.
|
|
188
|
+
* @param other Right-hand guard.
|
|
189
|
+
* @returns Fresh intersection guard requiring both schemas to pass.
|
|
190
|
+
*/
|
|
129
191
|
intersect(other) {
|
|
130
192
|
return new BaseGuard({
|
|
131
193
|
tag: SchemaTag.Intersection,
|
package/dist/guard/error.d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file error.ts
|
|
3
3
|
* @brief TypeSea assertion error.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
4
6
|
*/
|
|
5
7
|
import type { Issue } from "../issue/index.js";
|
|
6
8
|
/**
|
|
7
|
-
* @brief
|
|
8
|
-
* @details
|
|
9
|
-
*
|
|
9
|
+
* @brief Error thrown by assert() after validation has already produced issues.
|
|
10
|
+
* @details The issue array is copied before publication so callers cannot mutate
|
|
11
|
+
* diagnostic state through the error object.
|
|
10
12
|
*/
|
|
11
13
|
export declare class TypeSeaAssertionError extends Error {
|
|
12
14
|
readonly issues: readonly Issue[];
|
|
13
15
|
/**
|
|
14
|
-
* @brief
|
|
15
|
-
|
|
16
|
+
* @brief Construct an assertion error from validation issues.
|
|
17
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
18
|
+
* existing guard instance.
|
|
19
|
+
* @param issues Issues produced by checkSchema.
|
|
20
|
+
* @post Published issues are copied and exposed through a readonly property.
|
|
16
21
|
*/
|
|
17
22
|
constructor(issues: readonly Issue[]);
|
|
18
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/guard/error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/guard/error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC5C,SAAwB,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAEjD;;;;;;OAMG;gBACgB,MAAM,EAAE,SAAS,KAAK,EAAE;CAK9C"}
|
package/dist/guard/error.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file error.ts
|
|
3
3
|
* @brief TypeSea assertion error.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
4
6
|
*/
|
|
5
7
|
import { copyIssueArray } from "../issue/index.js";
|
|
6
8
|
import { defineReadonlyProperty } from "./props.js";
|
|
7
9
|
/**
|
|
8
|
-
* @brief
|
|
9
|
-
* @details
|
|
10
|
-
*
|
|
10
|
+
* @brief Error thrown by assert() after validation has already produced issues.
|
|
11
|
+
* @details The issue array is copied before publication so callers cannot mutate
|
|
12
|
+
* diagnostic state through the error object.
|
|
11
13
|
*/
|
|
12
14
|
export class TypeSeaAssertionError extends Error {
|
|
13
15
|
/**
|
|
14
|
-
* @brief
|
|
15
|
-
|
|
16
|
+
* @brief Construct an assertion error from validation issues.
|
|
17
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
18
|
+
* existing guard instance.
|
|
19
|
+
* @param issues Issues produced by checkSchema.
|
|
20
|
+
* @post Published issues are copied and exposed through a readonly property.
|
|
16
21
|
*/
|
|
17
22
|
constructor(issues) {
|
|
18
23
|
super("TypeSea assertion failed");
|
package/dist/guard/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file index.ts
|
|
3
3
|
* @brief Public guard module aggregation.
|
|
4
|
+
* @details This barrel keeps public import paths stable while implementation files remain
|
|
5
|
+
* split by responsibility.
|
|
4
6
|
*/
|
|
5
7
|
export { BaseGuard } from "./base.js";
|
|
6
8
|
export { TypeSeaAssertionError } from "./error.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,EACR,YAAY,EACf,MAAM,YAAY,CAAC"}
|
package/dist/guard/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file index.ts
|
|
3
3
|
* @brief Public guard module aggregation.
|
|
4
|
+
* @details This barrel keeps public import paths stable while implementation files remain
|
|
5
|
+
* split by responsibility.
|
|
4
6
|
*/
|
|
5
7
|
export { BaseGuard } from "./base.js";
|
|
6
8
|
export { TypeSeaAssertionError } from "./error.js";
|
package/dist/guard/number.d.ts
CHANGED
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file number.ts
|
|
3
3
|
* @brief Number guard implementation.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
4
6
|
*/
|
|
5
7
|
import type { NumberSchema } from "../schema/index.js";
|
|
6
8
|
import { BaseGuard } from "./base.js";
|
|
7
9
|
import type { Presence } from "./types.js";
|
|
8
10
|
/**
|
|
9
|
-
* @brief number
|
|
10
|
-
* @details
|
|
11
|
-
*
|
|
11
|
+
* @brief Persistent builder for finite number predicates.
|
|
12
|
+
* @details Bounds are normalized before entering the schema so the evaluator
|
|
13
|
+
* and compiler never have to defend against NaN or infinities later.
|
|
12
14
|
*/
|
|
13
15
|
export declare class NumberGuard<TPresence extends Presence = "required"> extends BaseGuard<number, TPresence> {
|
|
14
16
|
/**
|
|
15
|
-
* @brief
|
|
16
|
-
|
|
17
|
+
* @brief Construct a frozen number guard.
|
|
18
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
19
|
+
* existing guard instance.
|
|
20
|
+
* @param schema Number schema backing this guard.
|
|
17
21
|
*/
|
|
18
22
|
constructor(schema: NumberSchema);
|
|
19
23
|
/**
|
|
20
|
-
* @brief
|
|
21
|
-
|
|
24
|
+
* @brief Require finite numbers to be integers.
|
|
25
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
26
|
+
* existing guard instance.
|
|
27
|
+
* @returns Fresh NumberGuard with an appended integer check.
|
|
28
|
+
*/
|
|
22
29
|
int(): NumberGuard<TPresence>;
|
|
23
30
|
/**
|
|
24
|
-
* @brief
|
|
25
|
-
|
|
31
|
+
* @brief Add an inclusive lower bound.
|
|
32
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
33
|
+
* existing guard instance.
|
|
34
|
+
* @param value Finite lower bound.
|
|
35
|
+
* @returns Fresh NumberGuard with an appended gte check.
|
|
36
|
+
*/
|
|
26
37
|
gte(value: number): NumberGuard<TPresence>;
|
|
27
38
|
/**
|
|
28
|
-
* @brief
|
|
29
|
-
|
|
39
|
+
* @brief Add an inclusive upper bound.
|
|
40
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
41
|
+
* existing guard instance.
|
|
42
|
+
* @param value Finite upper bound.
|
|
43
|
+
* @returns Fresh NumberGuard with an appended lte check.
|
|
44
|
+
*/
|
|
30
45
|
lte(value: number): NumberGuard<TPresence>;
|
|
31
46
|
}
|
|
32
47
|
//# sourceMappingURL=number.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/guard/number.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/guard/number.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAMtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,qBAAa,WAAW,CACpB,SAAS,SAAS,QAAQ,GAAG,UAAU,CACzC,SAAQ,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAElC;;;;;OAKG;gBACgB,MAAM,EAAE,YAAY;IAKvC;;;;;OAKG;IACI,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC;IAapC;;;;;;OAMG;IACI,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAmBjD;;;;;;OAMG;IACI,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;CAcpD"}
|
package/dist/guard/number.js
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file number.ts
|
|
3
3
|
* @brief Number guard implementation.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
4
6
|
*/
|
|
5
7
|
import { NumberCheckTag, SchemaTag } from "../kind/index.js";
|
|
6
8
|
import { BaseGuard } from "./base.js";
|
|
7
9
|
import { checkFiniteNumberBound, readNumberConstructorSchema, readNumberMethodSchema } from "./read.js";
|
|
8
10
|
/**
|
|
9
|
-
* @brief number
|
|
10
|
-
* @details
|
|
11
|
-
*
|
|
11
|
+
* @brief Persistent builder for finite number predicates.
|
|
12
|
+
* @details Bounds are normalized before entering the schema so the evaluator
|
|
13
|
+
* and compiler never have to defend against NaN or infinities later.
|
|
12
14
|
*/
|
|
13
15
|
export class NumberGuard extends BaseGuard {
|
|
14
16
|
/**
|
|
15
|
-
* @brief
|
|
16
|
-
|
|
17
|
+
* @brief Construct a frozen number guard.
|
|
18
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
19
|
+
* existing guard instance.
|
|
20
|
+
* @param schema Number schema backing this guard.
|
|
17
21
|
*/
|
|
18
22
|
constructor(schema) {
|
|
19
23
|
super(readNumberConstructorSchema(schema));
|
|
20
24
|
Object.freeze(this);
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
|
-
* @brief
|
|
24
|
-
|
|
27
|
+
* @brief Require finite numbers to be integers.
|
|
28
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
29
|
+
* existing guard instance.
|
|
30
|
+
* @returns Fresh NumberGuard with an appended integer check.
|
|
31
|
+
*/
|
|
25
32
|
int() {
|
|
26
33
|
const schema = readNumberMethodSchema(this, "number int receiver");
|
|
27
34
|
return new NumberGuard({
|
|
@@ -35,11 +42,19 @@ export class NumberGuard extends BaseGuard {
|
|
|
35
42
|
});
|
|
36
43
|
}
|
|
37
44
|
/**
|
|
38
|
-
* @brief
|
|
39
|
-
|
|
45
|
+
* @brief Add an inclusive lower bound.
|
|
46
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
47
|
+
* existing guard instance.
|
|
48
|
+
* @param value Finite lower bound.
|
|
49
|
+
* @returns Fresh NumberGuard with an appended gte check.
|
|
50
|
+
*/
|
|
40
51
|
gte(value) {
|
|
41
52
|
const schema = readNumberMethodSchema(this, "number gte receiver");
|
|
42
53
|
const bound = checkFiniteNumberBound(value, "gte");
|
|
54
|
+
/*
|
|
55
|
+
* Bounds are normalized before schema construction so interpreters and
|
|
56
|
+
* compilers never need to handle NaN or infinity inside hot validation.
|
|
57
|
+
*/
|
|
43
58
|
return new NumberGuard({
|
|
44
59
|
tag: SchemaTag.Number,
|
|
45
60
|
checks: [
|
|
@@ -52,8 +67,12 @@ export class NumberGuard extends BaseGuard {
|
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
69
|
/**
|
|
55
|
-
* @brief
|
|
56
|
-
|
|
70
|
+
* @brief Add an inclusive upper bound.
|
|
71
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
72
|
+
* existing guard instance.
|
|
73
|
+
* @param value Finite upper bound.
|
|
74
|
+
* @returns Fresh NumberGuard with an appended lte check.
|
|
75
|
+
*/
|
|
57
76
|
lte(value) {
|
|
58
77
|
const schema = readNumberMethodSchema(this, "number lte receiver");
|
|
59
78
|
const bound = checkFiniteNumberBound(value, "lte");
|
package/dist/guard/props.d.ts
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file props.ts
|
|
3
3
|
* @brief Guard object shape helpers.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @brief Define one immutable public property.
|
|
9
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
10
|
+
* existing guard instance.
|
|
11
|
+
* @param target Object receiving the property.
|
|
12
|
+
* @param key Property key.
|
|
13
|
+
* @param value Stored property value.
|
|
14
|
+
* @param enumerable Whether the property should appear in enumeration.
|
|
15
|
+
* @post The property is non-configurable and non-writable.
|
|
4
16
|
*/
|
|
5
17
|
export declare function defineReadonlyProperty(target: object, key: string, value: unknown, enumerable: boolean): void;
|
|
6
18
|
/**
|
|
7
|
-
* @brief
|
|
19
|
+
* @brief Test for the only accepted refinement success value.
|
|
20
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
21
|
+
* existing guard instance.
|
|
22
|
+
* @param value Predicate return value.
|
|
23
|
+
* @returns True only for the boolean literal true.
|
|
8
24
|
*/
|
|
9
25
|
export declare function isStrictTrue(value: unknown): boolean;
|
|
10
26
|
/**
|
|
11
|
-
* @brief is record.
|
|
27
|
+
* @brief Test whether a value is a non-array object record.
|
|
28
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
29
|
+
* existing guard instance.
|
|
30
|
+
* @param value Candidate runtime value.
|
|
31
|
+
* @returns True for object values that can carry string properties.
|
|
12
32
|
*/
|
|
13
33
|
export declare function isRecord(value: unknown): value is Readonly<Record<string, unknown>>;
|
|
14
34
|
/**
|
|
15
|
-
* @brief
|
|
35
|
+
* @brief Accept only unmodified RegExp instances for schema storage.
|
|
36
|
+
* @details User-owned exec/test/source/flags overrides can change validation
|
|
37
|
+
* behavior after construction, so they are rejected at the API boundary.
|
|
38
|
+
* @param value Candidate pattern.
|
|
39
|
+
* @returns True for plain RegExp instances without own behavioral overrides.
|
|
16
40
|
*/
|
|
17
41
|
export declare function isPlainRegExp(value: unknown): value is RegExp;
|
|
18
42
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/guard/props.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/guard/props.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,OAAO,GACpB,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAO7D"}
|
package/dist/guard/props.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file props.ts
|
|
3
3
|
* @brief Guard object shape helpers.
|
|
4
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
5
|
+
* existing guard instance.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @brief Define one immutable public property.
|
|
9
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
10
|
+
* existing guard instance.
|
|
11
|
+
* @param target Object receiving the property.
|
|
12
|
+
* @param key Property key.
|
|
13
|
+
* @param value Stored property value.
|
|
14
|
+
* @param enumerable Whether the property should appear in enumeration.
|
|
15
|
+
* @post The property is non-configurable and non-writable.
|
|
4
16
|
*/
|
|
5
17
|
export function defineReadonlyProperty(target, key, value, enumerable) {
|
|
6
18
|
Object.defineProperty(target, key, {
|
|
@@ -11,19 +23,31 @@ export function defineReadonlyProperty(target, key, value, enumerable) {
|
|
|
11
23
|
});
|
|
12
24
|
}
|
|
13
25
|
/**
|
|
14
|
-
* @brief
|
|
26
|
+
* @brief Test for the only accepted refinement success value.
|
|
27
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
28
|
+
* existing guard instance.
|
|
29
|
+
* @param value Predicate return value.
|
|
30
|
+
* @returns True only for the boolean literal true.
|
|
15
31
|
*/
|
|
16
32
|
export function isStrictTrue(value) {
|
|
17
33
|
return value === true;
|
|
18
34
|
}
|
|
19
35
|
/**
|
|
20
|
-
* @brief is record.
|
|
36
|
+
* @brief Test whether a value is a non-array object record.
|
|
37
|
+
* @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
|
|
38
|
+
* existing guard instance.
|
|
39
|
+
* @param value Candidate runtime value.
|
|
40
|
+
* @returns True for object values that can carry string properties.
|
|
21
41
|
*/
|
|
22
42
|
export function isRecord(value) {
|
|
23
43
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
44
|
}
|
|
25
45
|
/**
|
|
26
|
-
* @brief
|
|
46
|
+
* @brief Accept only unmodified RegExp instances for schema storage.
|
|
47
|
+
* @details User-owned exec/test/source/flags overrides can change validation
|
|
48
|
+
* behavior after construction, so they are rejected at the API boundary.
|
|
49
|
+
* @param value Candidate pattern.
|
|
50
|
+
* @returns True for plain RegExp instances without own behavioral overrides.
|
|
27
51
|
*/
|
|
28
52
|
export function isPlainRegExp(value) {
|
|
29
53
|
return value instanceof RegExp &&
|