%dw 2.0
import someEntry from dw::core::Objects
output application/json
---
{
a: {} someEntry (value, key) -> value is String,
b: {a: "", b: "123"} someEntry (value, key) -> value is String,
c: {a: "", b: 123} someEntry (value, key) -> value is String,
d: {a: "", b: 123} someEntry (value, key) -> key as String == "a",
e: {a: ""} someEntry (value, key) -> key as String == "b",
f: null someEntry (value, key) -> key as String == "a"
}
someEntry
someEntry(Object, (value: Any, key: Key) -> Boolean): Boolean
Returns true
if at least one entry in the object matches the specified condition.
The function stops iterating after the first element that matches the condition is found.
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
|
The object to evaluate. |
|
The condition to use when evaluating elements in the object. |
Example
This example shows how the someEntry
behaves with different inputs.