-
-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathkinds.ts
More file actions
68 lines (61 loc) · 1.86 KB
/
Copy pathkinds.ts
File metadata and controls
68 lines (61 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import type { BaseConstraint } from "../constraint.ts"
import type { nodeImplementationOf } from "../shared/implement.ts"
import { After } from "./after.ts"
import { Before } from "./before.ts"
import { ExactLength } from "./exactLength.ts"
import { Max } from "./max.ts"
import { MaxLength } from "./maxLength.ts"
import { MaxSize } from "./maxSize.ts"
import { Min } from "./min.ts"
import { MinLength } from "./minLength.ts"
import { MinSize } from "./minSize.ts"
export interface BoundDeclarations {
min: Min.Declaration
max: Max.Declaration
minLength: MinLength.Declaration
maxLength: MaxLength.Declaration
exactLength: ExactLength.Declaration
after: After.Declaration
before: Before.Declaration
minSize: MinSize.Declaration
maxSize: MaxSize.Declaration
}
export interface BoundNodesByKind {
min: Min.Node
max: Max.Node
minLength: MinLength.Node
maxLength: MaxLength.Node
exactLength: ExactLength.Node
after: After.Node
before: Before.Node
minSize: MinSize.Node
maxSize: MaxSize.Node
}
export type BoundKind = keyof BoundDeclarations
export type RangeKind = Exclude<BoundKind, "exactLength">
export type boundImplementationsByKind = {
[k in BoundKind]: nodeImplementationOf<BoundDeclarations[k]>
}
export const boundImplementationsByKind: boundImplementationsByKind = {
min: Min.implementation,
max: Max.implementation,
minLength: MinLength.implementation,
maxLength: MaxLength.implementation,
exactLength: ExactLength.implementation,
after: After.implementation,
before: Before.implementation,
minSize: MinSize.implementation,
maxSize: MaxSize.implementation
}
export const boundClassesByKind: Record<BoundKind, typeof BaseConstraint<any>> =
{
min: Min.Node,
max: Max.Node,
minLength: MinLength.Node,
maxLength: MaxLength.Node,
exactLength: ExactLength.Node,
after: After.Node,
before: Before.Node,
minSize: MinSize.Node,
maxSize: MaxSize.Node
}