Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

Conditional map in jq

$
0
0

Is there a way to use map() in a conditional manner ?

My problem is that I am using jq against Github repos.

Some repos (e.g. https://api.github.com/repos/containerd/nerdctl/releases) use prerelease flag and therefore I can use map(select(.prerelease==false))|first

Other repos (e.g. https://api.github.com/repos/slsa-framework/slsa-verifier/releases) do not and therefore map(select(.prerelease==false)) has no effect.

Therefore I need a way to conditionally check for the existence of .prerelease and if present apply map().


Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>