REJECT

Takes an array or an object as well as a lambda function or an array of values to remove. If the input is an array, it returns a new array with all the values that do not match the lambda function or are not in the array of values to remove. If the input is an object, it returns a new object with all the key-value pairs with values that do not match the lambda function or are not in the array of values to remove.

Syntax 

REJECT(array | object, values_to_remove | LAMBDA(item, [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

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(item, item > 2))

Output

1
{
2
"a": 1,
3
"b": 2
4
}

Sample Actions 

Event transform
REJECT
Event transform
My Action

Select an action to inspect.

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?