You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose adding a method array to bloblang, which returns always an array. Specifically, every non-array input is returned as single element array, while an array input is returned as-is. This is similar to the bytes method and motivated originally by parsing XML files transformed to JSON: An XML element with a single child element (or attribute) is returned as sub-object, while multiple child elements/attributes are returned as array. To further process such a subtree, it needs to be ensured always an array is returned. Practically this results in unwieldy constructs like this.with("name").values().flatten(). The newly proposed array method would reduce this to the more readable this.name.array().
Dear All,
I would like to propose adding a method
array
to bloblang, which returns always an array. Specifically, every non-array input is returned as single element array, while an array input is returned as-is. This is similar to thebytes
method and motivated originally by parsing XML files transformed to JSON: An XML element with a single child element (or attribute) is returned as sub-object, while multiple child elements/attributes are returned as array. To further process such a subtree, it needs to be ensured always an array is returned. Practically this results in unwieldy constructs likethis.with("name").values().flatten()
. The newly proposedarray
method would reduce this to the more readablethis.name.array()
.Here is the associated pull request: #2538
Thank you for considering this enhancement
Best
The text was updated successfully, but these errors were encountered: