UNPKG

1.77 kBMarkdownView Raw
1<a name="HandlebarsHelpers"></a>
2
3## HandlebarsHelpers
4Generic helpers that work with any handlebars project
5
6**Kind**: global namespace
7
8* [HandlebarsHelpers](#HandlebarsHelpers) : <code>object</code>
9 * [.concat(...string, options)](#HandlebarsHelpers.concat) ⇒ <code>String</code>
10 * [.stringify([string])](#HandlebarsHelpers.stringify) ⇒ <code>String</code>
11
12
13* * *
14
15<a name="HandlebarsHelpers.concat"></a>
16
17### concat(...string, options)
18Concatenates two or more strings
19
20**Kind**: static method of [<code>HandlebarsHelpers</code>](#HandlebarsHelpers)
21**Returns**: <code>String</code> - - One concatenated string
22
23| Param | Type | Description |
24| --- | --- | --- |
25| ...string | <code>string</code> | two or more strings to concatenate |
26| options | <code>Object</code> | passed by handlebars |
27| options.hash | <code>Object</code> | named key/value pairs |
28| options.hash.separator | <code>string</code> | string to separate each value |
29
30**Example**
31```js
32{{concat "string1" "string2"}}
33```
34**Example**
35```js
36{{concat "string1" "string2" separator="-"}}
37```
38
39* * *
40
41<a name="HandlebarsHelpers.stringify"></a>
42
43### stringify([string])
44JSON.stringify a string or block
45
46**Kind**: static method of [<code>HandlebarsHelpers</code>](#HandlebarsHelpers)
47**Returns**: <code>String</code> - - JSON.stringify result of block or string
48
49| Param | Type | Description |
50| --- | --- | --- |
51| [string] | <code>string</code> | String to use if block is not present |
52
53**Example**
54```js
55{{stringify "a !string for {json} /end"}}
56```
57**Example**
58```js
59{{#stringify}}
60 mybash.sh -o option1
61 continue.sh
62{{/stringify}}
63```
64**Example**
65```js
66{{#stringify noLineBreaks}}
67 docker run
68 -e VAR1=VAL1
69 -e VAR2=VAL2
70 my/image
71{{/stringify}}
72```
73
74* * *
75