Pick Object By Predicate
Includes only the properties selected by Predicate
Description
The idea of the brick is to return a list of certain items. Which items to pick is decided in the Predicate. The 'Predicate' is a function that will be applied to each item in the list.
Example:
-
inputs
- source =
{ "a": 1, "b": "user", "c": 3 }
- Predicate=
value => "Is Not a Number"
- source =
-
outputs
- result =
{ "b": "user" }
- result =
In the example, the brick looks at the object's "Source" and then looks at the 'Predicate'. Since the 'Predicate' accepts only values that are not a number, only the objects the value of which is not a number will be chosen and the brick will return a new object as 'Result'.
Inputs
- Source (Object): The object to query. JSON object or string
- Predicate (Object Iteratee): The predicate function is invoked for each entry (key, value).
Inputs:
-key (string)
: The current property of the object.
-value (object)
: The properties' value.
-object (Object)
: The current object.
Outputs:
-Result (Boolean): Should the result include the property or not? Set it totrue
if theproperty
should be omitted,false
if you do not want the property.
Outputs
- Result (Object): The new updated object
- Error Flow (Error Flow): Triggered by providing incorrect json