%dw 2.0
import * from dw::util::Tree
output application/dw  
---
{
  a: in0 mapLeafValues ((value, path) ->
    if (path[-1].selector == "password")
      "*****"
    else
      value),
  b: in0 mapLeafValues ((value, path) ->
    if (asExpressionString(path) endsWith "password")
      "*****"
    else
      value),
  c: in0 mapLeafValues ((value, path) ->
    if (path[-1].kind == ATTRIBUTE_TYPE)
      "*****"
    else
      value),
  d: in1 mapLeafValues ((value, path) ->
    if (asExpressionString(path) == ".user.password")
      "*****"
    else
      value),
  d: in2 mapLeafValues ((value, path) ->
    if (asExpressionString(path) == "[1].user.password")
      "*****"
    else
      value),
  c: [null] mapLeafValues ((value, path) -> "test"),
  d: {a: null} mapLeafValues ((value, path) -> "test"),
  e: true mapLeafValues ((value, path) -> "test"),
}