%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: Object, condition: (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 version 2.3.0.
Parameters
Name | Description |
---|---|
|
The object to evaluate. |
|
The condition to apply to each element. |
Example
This example shows how everyEntry
behaves with different inputs.