-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnot_null.yml
More file actions
60 lines (60 loc) · 1.4 KB
/
not_null.yml
File metadata and controls
60 lines (60 loc) · 1.4 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
name: not_null
topic: misc
args:
required:
- name: argument
type: any
variadic:
type: any
returns:
type: any
desc: |
Returns the first argument that does not resolve to `null`. This function
accepts one or more arguments, and will evaluate them in order until a
non null argument is encounted. If all arguments values resolve to `null`,
then a value of `null` is returned.
examples:
test0:
context: {a: !!null '', b: !!null '', c: [], d: foo}
args: [no_exist, a, b, c, d]
returns: []
test1:
context: {a: !!null '', b: !!null '', c: [], d: foo}
args: [a, b, !!null '', d, c]
returns: foo
test2:
context: {a: !!null '', b: !!null '', c: [], d: foo}
args: [a, b]
returns:
test3:
context: &data
foo: -1
zero: 0
numbers: [-1, 3, 4, 5]
array: [-1, 3, 4, 5, a, '100']
strings: [a, b, c]
decimals: [1.01, 1.2, -1.5]
str: Str
'false': false
empty_list: []
empty_hash: {}
objects: {foo: bar, bar: baz}
null_key:
args: [unknown_key, str]
returns: Str
test4:
context: *data
args: [unknown_key, foo.bar, empty_list, str]
returns: []
test5:
context: *data
args: [unknown_key, null_key, empty_list, str]
returns: []
test6:
context: *data
args: [all, expressions, are_null]
returns:
test7:
context: *data
args: ['']
error: invalid-arity