Replies: 1 comment 1 reply
-
Hey @gramian, I guess you could also use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear All,
I would like to propose a new method for bloblang. This method provisionally called
must_array
behaves as follows:must_array
returns its input (identity)must_array
wraps its input in an arrayExamples:
Currently, one can emulate this behavior in bloblang:
It could be discussed, how this function would behave for
null
: for example an empty array could be returned(?).Why is this useful?
I am working with
xml
messages, which when parsed intojson
yield objects or strings if only one instance of a tag appears, and an array if multiple instances are found in one node. To process such results further with the same machinery these parsed tags need thave to be arrays, somap_each
,fold
,filter
can be applied equally.A real-life example for such an
xml
format ismods
.The emulated function can be made a
map
to be reused, but if I understand correctly, for example, it would need to be imported or redefined in every mapping of every branch in a workflow.Thank you for considering my proposal!
PS: This came up in the "questions" Discord channel.
Beta Was this translation helpful? Give feedback.
All reactions