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