Contact Us 1-800-596-4880

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

object

The object to evaluate.

condition

The condition to apply to each element.

Example

This example shows how everyEntry behaves with different inputs.

Source

%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")
}

Output

{
  "a": true,
  "b": true,
  "c": false,
  "d": false,
  "e": true,
  "f": true
}

everyEntry(Null, (Nothing, Nothing) -> Boolean): Boolean

Helper function that enables everyEntry to work with a null value.

Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.