takeWhile<T>(obj: Object, condition: (value: Any, key: Key) -> Boolean): Object
Selects key-value pairs from the object while the condition is met.
Introduced in DataWeave version 2.3.0.
Parameters
| Name | Description |
|---|---|
|
The object to filter. |
|
The condition (or expression) used to match a key-value pairs in the object. |
Example
This example iterates over the key-value pairs in the object and selects the elements while the condition is met. It outputs the result into an object.