%dw 2.0
output application/json
var a1 = [2,3,5,7,11]
var r1 = 2 to 11
var o1 = {one:1,two:2,three:3}
---
{
// digits: a1,
elements: o1,
// moreDigits: a1 + r1, // r1 added as final element of result
// flatDigits: a1 ++ r1, // elements from r1 appended to a1
// arrayAndObject: a1 + o1, // o1 becomes final element of result
// objectAndArray: o1 + a1, // error, you can't do that
// objectWithNewArray: o1 ++ {stuff:a1},
// alsoWithNewArray: o1 ++ stuff2: a1, // same as last line
// concatObjects: o1 ++ o1 ++ {three:3,four:4},
// filterObjects: o1 ++ o1 - "two", // subtraction before concatenation
// sequencedFilter: (o1 ++ o1) - "two",
// appendToArray: a1 << 100, // new append operator
// prependToArray: 100 >> a1, // can you say push?
// bigAppend: a1 << r1, // acts like the addition operator
subtractElements: o1 - "two", // removes element with this key
removeElement: o1 -- {two:2,one:1,three:7}, // removes all kvps that exist
maskElements: o1 -- ["three","one"], // removes all elements with these keys
removeByReference: o1 ++ o1 - "two",
alsoRemove: (o1 ++ o1) - "two", // gets 'em all
}
Comments