Is there a way to take a recursive function (like the following) and make it tail recursive? I have an input like this:
{
"message": "Test ",
"read": [
{
"test": " t "
}
]
}
and this Dataweave function
fun trimWS(item) = item match {
case is Array -> $ map trimWS($)
case is Object -> $ mapObject {
($$): $ match {
case is String -> trim($)
case is Object -> trimWS($)
case is Array -> $ map trimWS($)
else -> $
}
}
case is String -> trim($)
else -> $
}