From 10fdd5565b5830771c425c90102f8d3e14ac217b Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Sun, 12 Mar 2017 23:04:12 +0100 Subject: [PATCH] tpl: Add union template func --- content/templates/functions.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/content/templates/functions.md b/content/templates/functions.md index f20aebebc..e4c885c3c 100644 --- a/content/templates/functions.md +++ b/content/templates/functions.md @@ -214,6 +214,23 @@ e.g. +### union +Given two arrays (or slices) A and B, this function will return a new array that contains the elements or objects that belong to either A or to B or to both. The elements supported are strings, integers and floats (only float64). + +``` +{{ union (slice 1 2 3) (slice 3 4 5) }} + + +{{ union (slice 1 2 3) nil }} + + +{{ union nil (slice 1 2 3) }} + + +{{ union nil nil }} + +``` + ### isset Returns true if the parameter is set. Takes either a slice, array or channel and an index or a map and a key as input.