Returns a list of key value pair object describing the object entries
Example
%dw 2.0
import dw::core::Objects
---
Objects::entrySet({a: true, b: 1})
Output
[{key: "a", value: true}, {key: "b", value: 1}]
Functions
EntryAt
entryAt({ (K): V }, Number): { (K)?: V } | Null
Returns selecting only the entry at the specified index. If the index is not valid it return null. If index es less than 0 then it will start from the last element e.g {a: true, b: 1} entryAt -1 returns the last entry
Example
%dw 2.0
import dw::core::Objects
---
Objects::entryAt({a: true, b: 1}, 0)
Output
{a: true}
EntrySet
entrySet(T)
KeySet
keySet(T): ?
Returns the list of key names of an object
Example
%dw 2.0
import dw::core::Objects
---
Objects::nameSet({a: true, b: 1})
Output
["a","b"]
MergeWith
mergeWith(T, V): ?
Overrides the source with the target object so that the result with contain all the properties from the target plus the properties on the source that are not declared on the target
Example
%dw 2.0
import mergeWith from dw::core::Objects
---
{a: true, b: 1} mergeWith {a: false, c: "Test"}
Output
{a: false, b: 1 , c: "Test"}
mergeWith(Null, T): T
Helper method to make mergetWith
null friendly
mergeWith(T, Null): T
Helper method to make mergetWith
null friendly
NameSet
nameSet(Object): Array<String>
Returns the list of key names of an object
Example
%dw 2.0
import dw::core::Objects
---
Objects::nameSet({a: true, b: 1})
Output
["a","b"]
ValueSet
valueSet({ K?: V }): Array<V>
Returns the list of key values of an object
Example
%dw 2.0
import dw::core::Objects
---
Objects::nameSet({a: true, b: 1})
Output
[true,1]