-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
90 lines (89 loc) · 2.02 KB
/
index.ts
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import "./Always"
import { And, and } from "./And"
import { Any, any } from "./Any"
import { Criteria } from "./Criteria"
import { Definition } from "./Definition"
import { EndsWith, endsWith } from "./EndsWith"
import { Every, every } from "./Every"
import { FunctionCall } from "./FunctionCall"
import { GreaterThan, greaterThan } from "./GreaterThan"
import { GreaterThanOrEqual, greaterThanOrEqual } from "./GreaterThanOrEqual"
import { Has, has } from "./Has"
import { Includes, includes } from "./Includes"
import { Is } from "./Is"
import { LesserThan, lesserThan } from "./LesserThan"
import { LesserThanOrEqual, lesserThanOrEqual } from "./LesserThanOrEqual"
import { Match, match } from "./Match"
import { Not, not } from "./Not"
import { Or, or } from "./Or"
import { parse, parseExpression } from "./parse"
import { Property, property } from "./Property"
import { resolve } from "./resolve"
import { create, Rule } from "./Rule"
import { Some, some } from "./Some"
import { StartsWith, startsWith } from "./StartsWith"
import { Tuple } from "./Tuple"
import { Type as SType } from "./Type"
import { Value } from "./Value"
import { Within, within } from "./Within"
function is(criteria: Criteria): Rule
function is(criteria: Criteria, value?: any): boolean
function is(criteria: Criteria, value?: any): Rule | boolean {
const result = create(criteria)
return value ? result.is(value) : result
}
function filter<T>(criteria: Criteria, value: T[]): T[] {
const c = create(criteria)
return c.filter(value)
}
export * as selectively from "./selectively"
export {
And,
Any,
Criteria,
Definition,
EndsWith,
Every,
FunctionCall,
Has,
GreaterThan,
GreaterThanOrEqual,
LesserThan,
LesserThanOrEqual,
Includes,
Is,
Match,
Not,
Or,
Property,
Rule,
Some,
StartsWith,
Tuple,
SType as Type,
Value,
Within,
any,
and,
create,
endsWith,
every,
has,
filter,
greaterThan,
greaterThanOrEqual,
lesserThan,
lesserThanOrEqual,
includes,
is,
match,
not,
or,
parse,
parseExpression,
property,
resolve,
some,
startsWith,
within,
}