This is not working, tried many combinations of key and operator but without luck.
{{ where (slice 100 200 300 400 500 600) `.` `<=` 500 }}
This is not working, tried many combinations of key and operator but without luck.
{{ where (slice 100 200 300 400 500 600) `.` `<=` 500 }}
can you explain more explicitly what you try to achieve? It looks to me like you want to go through some slices that are lower than 500, so you might expect 4 instances? maybe using " instead of ` might help (out of the box)?
I suspect something like this is the best you can do:
{{ $result := slice }}
{{ range (slice 100 200 300 400 500 600) }}
{{ if le . 500 }}
{{ $result = append $result . }}
{{ end }}
{{ end }}
Note that since partials now can “return stuff”, you can put this into a partial and reuse it.
this is similar to how i solved it. It just seemed it could work with that pretty one liner. Thank you.