add join function (#204)

* add join function

* fix formatting to match single include

* add join test

* add join to documentation

* fix MSVC warning: signed/unsigned mismatch

Co-authored-by: Wim Leflere <wleflere@cochlear.com>
This commit is contained in:
Wim Leflere
2021-06-17 20:54:22 +02:00
committed by GitHub
co-authored by Wim Leflere
parent 9cf7db8a06
commit 91c93bfb77
5 changed files with 49 additions and 0 deletions
+4
View File
@@ -224,6 +224,10 @@ render("{{ last(guests) }} was last.", data); // "Patir was last."
render("{{ sort([3,2,1]) }}", data); // "[1,2,3]"
render("{{ sort(guests) }}", data); // "[\"Jeff\", \"Patrick\", \"Tom\"]"
// Join a list with a separator
render("{{ join([1,2,3], \" + \") }}", data); // "1 + 2 + 3"
render("{{ join(guests, \", \") }}", data); // "Jeff, Patrick, Tom"
// Round numbers to a given precision
render("{{ round(3.1415, 0) }}", data); // 3
render("{{ round(3.1415, 3) }}", data); // 3.142