Assuming I have a dict
that is created somehow dynamically and then sorted and processed, is there a way to get all values
of the dict
or will I always have to range though the dict to get the items in a slice?
Sample dict
:
{{ $something := dict
"key1" "value1"
"key2" "value2"
}}
sample result:
{{ $values := "value1" "value2" }}
I know I could do a simple range
, but is there a command to do this quickly?
{{ $values := slice }}
{{ range $key, $value := $something }}
{{ $values := $values | append $value }}
{{ end }}
The specific use case is a method that collects pages that are in several sections where each section has a different way to sort it’s pages.