Syntax
REJECT(array | object, values_to_remove | LAMBDA(arg1, [arg2], expr))
Usage examples
Example 1
Input | 1 { 2 "my_array": [ 3 1, 4 2, 5 3, 6 4, 7 5, 8 6, 9 7, 10 8, 11 9, 12 10 13 ] 14 } |
Formula | REJECT(my_array, ARRAY(2, 4, 6, 8, 10)) |
Output | 1 [ 2 1, 3 3, 4 5, 5 7, 6 9 7 ] |
Example 2
Input | 1 { 2 "my_array": [ 3 1, 4 2, 5 3, 6 4, 7 5, 8 6, 9 7, 10 8, 11 9, 12 10 13 ] 14 } |
Formula | REJECT(my_array, LAMBDA(item, item > 5)) |
Output | 1 [ 2 1, 3 2, 4 3, 5 4, 6 5 7 ] |
Example 3
Input | 1 { 2 "my_object": { 3 "a": 1, 4 "b": 2, 5 "c": 3, 6 "d": 4, 7 "e": 5 8 } 9 } |
Formula | REJECT(my_object, ARRAY(2, 4)) |
Output | 1 { 2 "a": 1, 3 "c": 3, 4 "e": 5 5 } |
Example 4
If the target is an object and the lambda takes one argument, the argument is the value.
Input | 1 { 2 "my_object": { 3 "a": 1, 4 "b": 2, 5 "c": 3, 6 "d": 4, 7 "e": 5 8 } 9 } |
Formula | REJECT(my_object, LAMBDA(value, value > 2)) |
Output | 1 { 2 "a": 1, 3 "b": 2 4 } |
Example 5
If the target is an object and the lambda takes two arguments, the first argument is the key and the second argument is the value.
Input | 1 { 2 "my_object": { 3 "a": 1, 4 "b": 2, 5 "c": 3, 6 "d": 4, 7 "e": 5 8 } 9 } |
Formula | REJECT(my_object, LAMBDA(key, value, key == 'a' || value > 3)) |
Output | 1 { 2 "b": 2, 3 "c": 3 4 } |
Sample Actions
Select an action to inspect.
You can also click "Copy actions" and paste them in your Tines story to see how they work.