This module contains helper functions to work with Objects.
It processes both keys and values as a tuple.
To use this module, you must import it to your DataWeave code, for example, by adding the line import * from dw::core::Objects
to the header of your DataWeave script.
We will start with a brief review of filterObject
, used to remove key-value pairs from an Object based on some criteria much like filter
is used in Arrays.
We’ll then discuss mapObject
, which is used to transform every key-value pair into something else.
We’ll also go over pluck
, a function that goes from Objects to Arrays and is very useful when combined with the groupBy
function we learned on the previous tutorial.
Name | Description |
---|---|
divideBy | Breaks up an object into sub-objects that contain the specified number of key-value pairs. |
entrySet | Returns an array of key-value pairs that describe the key, value, and any attributes in the input object. |
everyEntry | Returns true if every entry in the object matches the condition. |
keySet | Returns an array of key names from an object. |
mergeWith | Appends any key-value pairs from a source object to a target object. |
nameSet | Returns an array of keys from an object. |
someEntry | Returns true if at least one entry in the object matches the specified condition. |
takeWhile | Selects key-value pairs from the object while the condition is met. |
valueSet | Returns an array of the values from key-value pairs in an object. |
If you like my post please follow me to read my latest post on programming and technology.
You are given a stream of elements that is too large to fit into memory.…
The formula for the area of a circle is given by πr². Use the Monte…
Given an integer k and a string s, write a function to determine the length…
There is a staircase with N steps, and you can ascend either 1 step or…
Build an autocomplete system that, given a query string s and a set of possible…
Design a job scheduler that accepts a function f and an integer n. The scheduler…