-
Notifications
You must be signed in to change notification settings - Fork 11
/
any.go
37 lines (28 loc) · 930 Bytes
/
any.go
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
package any
import (
"qlova.org/seed/client"
"qlova.org/seed/client/if/the"
"qlova.org/seed/use/js"
)
//AreTrue returns a client.Bool that is true if any of its arguments are true.
func AreTrue(a, b client.Bool, others ...client.Bool) client.Bool {
var expression string = "(%v || %v"
var values = []client.Value{a, b}
for _, n := range others {
expression += " || %v"
values = append(values, n)
}
expression += ")"
return the.Bool(js.Bool{Value: js.NewValue(expression, values...)}, values...)
}
//AreFalse returns a client.Bool that is true if any of its arguments are false.
func AreFalse(a, b client.Bool, others ...client.Bool) client.Bool {
var expression string = "(!(%v && %v"
var values = []client.Value{a, b}
for _, n := range others {
expression += " && %v"
values = append(values, n)
}
expression += "))"
return the.Bool(js.Bool{Value: js.NewValue(expression, values...)}, values...)
}