Skip to content

Add ability to define custom predicate functions #508

Answered by antonmedv
neetle asked this question in General
Discussion options

You must be logged in to vote

Yes, it is possible to implement next expression, even if Nodes is not an array.

Nodes | filter(.Name=="cat")

To do it you can create a patcher which will be wrapping Nodes inside filter into a helper function. The helper function will transform Nodes to an array.

After the patcher resulting code should look like this:

nodesToArray(Nodes) | filter(.Name=="cat")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by antonmedv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #497 on January 02, 2024 10:12.