summaryrefslogtreecommitdiff
path: root/docs-src
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2019-01-28 20:15:00 -0500
committerGitHub <noreply@github.com>2019-01-28 20:15:00 -0500
commitad7c7479a4425aff310038e7538622b4347322de (patch)
tree551d9167b99202b3ba93d55aa340330745186157 /docs-src
parent2dfca4864d1f69715a229342efc7e335f176a29e (diff)
parent5d00abdb00b86b63135012b4f095f0d7915f34c1 (diff)
Merge pull request #469 from hairyhenderson/keys-values-funcs-467
New functions conv.Keys and conv.Values
Diffstat (limited to 'docs-src')
-rw-r--r--docs-src/content/functions/conv.yml44
1 files changed, 44 insertions, 0 deletions
diff --git a/docs-src/content/functions/conv.yml b/docs-src/content/functions/conv.yml
index 85432558..e12b510c 100644
--- a/docs-src/content/functions/conv.yml
+++ b/docs-src/content/functions/conv.yml
@@ -404,3 +404,47 @@ funcs:
- |
$ gomplate -i '{{ conv.ToStrings nil 42 true 0xF (slice 1 2 3) }}'
[nil 42 true 15 [1 2 3]]
+ - name: conv.Keys
+ alias: keys
+ description: |
+ Return a list of keys in one or more maps.
+
+ The keys will be ordered first by map position (if multiple maps are given),
+ then alphabetically.
+
+ See also [`conv.Values`](#conv-values).
+ arguments:
+ - name: in...
+ required: true
+ description: the maps
+ examples:
+ - |
+ $ gomplate -i '{{ $map := json `{"foo": 1, "bar": 2}` -}}
+ {{ conv.Keys $map }}'
+ [bar foo]
+ $ gomplate -i '{{ $map1 := json `{"foo": 1, "bar": 2}` -}}
+ {{ $map2 := json `{"baz": 3, "qux": 4}` -}}
+ {{ conv.Keys $map1 $map2 }}'
+ [bar foo baz qux]
+ - name: conv.Values
+ alias: values
+ description: |
+ Return a list of values in one or more maps.
+
+ The values will be ordered first by map position (if multiple maps are given),
+ then alphabetically by key.
+
+ See also [`conv.Keys`](#conv-keys).
+ arguments:
+ - name: in...
+ required: true
+ description: the maps
+ examples:
+ - |
+ $ gomplate -i '{{ $map := json `{"foo": 1, "bar": 2}` -}}
+ {{ conv.Values $map }}'
+ [2 1]
+ $ gomplate -i '{{ $map1 := json `{"foo": 1, "bar": 2}` -}}
+ {{ $map2 := json `{"baz": 3, "qux": 4}` -}}
+ {{ conv.Values $map1 $map2 }}'
+ [2 1 3 4]