@jaredwray/fumanchu 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,3055 @@
1
+ <div align="center"><img src="logo.png" alt="Fu Manchu"></div>
2
+
3
+ # fumanchu
4
+ Handlebars + Helpers Together
5
+
6
+ [![tests](https://github.com/jaredwray/fumanchu/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/fumanchu/actions/workflows/tests.yaml)
7
+ [![codecov](https://codecov.io/gh/jaredwray/fumanchu/graph/badge.svg?token=gtYw78huva)](https://codecov.io/gh/jaredwray/fumanchu)
8
+ [![npm version](https://img.shields.io/npm/v/fumanchu.svg)](https://npmjs.com/package/fumanchu)
9
+ [![GitHub license](https://img.shields.io/github/license/jaredwray/fumanchu)](https://github.com/jaredwray/fumanchu/blob/master/LICENSE)
10
+ [![npm](https://img.shields.io/npm/dm/fumanchu)](https://npmjs.com/package/fumanchu)
11
+
12
+ [Handlebars](https://github.com/handlebars-lang/handlebars.js) + [Handlebars-helpers](https://github.com/helpers/handlebars-helpers) (helpers are now maintained in this project) combined into a single package. Easily use in your nodejs or browser projects as it is a drop in replacement when using handlebars directly.
13
+
14
+ ## Table of Contents
15
+ * [Using in Nodejs](#using-in-nodejs)
16
+ * [Using in Browser](#using-in-browser)
17
+ * [Helpers](#helpers)
18
+ * [How to Contribute](#how-to-contribute)
19
+ * [License and Copyright](#license-and-copyright)
20
+
21
+ ## Usage Nodejs
22
+
23
+ ```bash
24
+ npm install @jaredwray/fumanchu
25
+ ```
26
+
27
+ ```javascript
28
+ var handlebars = require('fumanchu');
29
+ var template = handlebars.compile('{{#if (eq foo "bar")}}<p>Foo is bar</p>{{/if}}');
30
+ var html = template({foo: 'bar'});
31
+ console.log(html);
32
+ ```
33
+
34
+ It's just that easy! No need to add Handlebars to your project, it's already included.
35
+
36
+ ## Usage Browser - NOT WORKING YET
37
+
38
+ ```html
39
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/fumanchu/1.0.0/fumanchu.min.js"></script>
40
+ <script>
41
+ var template = fumanchu.compile('{{#if (eq foo "bar")}}<p>Foo is bar</p>{{/if}}');
42
+ var html = template({foo: 'bar'});
43
+ console.log(html);
44
+ </script>
45
+ ```
46
+
47
+ ## Helpers
48
+ More than 180 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate, Verb, Ghost, gulp-handlebars, grunt-handlebars, consolidate, or any node.js/Handlebars project.
49
+
50
+ ## Categories
51
+
52
+ Currently **189 helpers** in **20 categories**:
53
+
54
+ * **[array](#array)** ([code](lib/array.js) | [unit tests](test/array.js))
55
+ * **[code](#code)** ([code](lib/code.js) | [unit tests](test/code.js))
56
+ * **[collection](#collection)** ([code](lib/collection.js) | [unit tests](test/collection.js))
57
+ * **[comparison](#comparison)** ([code](lib/comparison.js) | [unit tests](test/comparison.js))
58
+ * **[date](#date)** ([code](lib/date.js) | [unit tests](test/date.js))
59
+ * **[fs](#fs)** ([code](lib/fs.js) | [unit tests](test/fs.js))
60
+ * **[html](#html)** ([code](lib/html.js) | [unit tests](test/html.js))
61
+ * **[i18n](#i18n)** ([code](lib/i18n.js) | [unit tests](test/i18n.js))
62
+ * **[inflection](#inflection)** ([code](lib/inflection.js) | [unit tests](test/inflection.js))
63
+ * **[logging](#logging)** ([code](lib/logging.js) | [unit tests](test/logging.js))
64
+ * **[markdown](#markdown)** ([code](lib/markdown.js) | [unit tests](test/markdown.js))
65
+ * **[match](#match)** ([code](lib/match.js) | [unit tests](test/match.js))
66
+ * **[math](#math)** ([code](lib/math.js) | [unit tests](test/math.js))
67
+ * **[misc](#misc)** ([code](lib/misc.js) | [unit tests](test/misc.js))
68
+ * **[number](#number)** ([code](lib/number.js) | [unit tests](test/number.js))
69
+ * **[object](#object)** ([code](lib/object.js) | [unit tests](test/object.js))
70
+ * **[path](#path)** ([code](lib/path.js) | [unit tests](test/path.js))
71
+ * **[regex](#regex)** ([code](lib/regex.js) | [unit tests](test/regex.js))
72
+ * **[string](#string)** ([code](lib/string.js) | [unit tests](test/string.js))
73
+ * **[url](#url)** ([code](lib/url.js) | [unit tests](test/url.js))
74
+
75
+ ## All helpers
76
+
77
+ ### [array helpers](#array)
78
+
79
+ Visit the: [code](lib/array.js) | [unit tests](test/array.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+array+helpers))
80
+
81
+ * **[after](#after)** ([code](lib/array.js#L22) | [tests](test/array.js#L13))
82
+ * **[arrayify](#arrayify)** ([code](lib/array.js#L39) | [tests](test/array.js#L29))
83
+ * **[before](#before)** ([code](lib/array.js#L58) | [tests](test/array.js#L36))
84
+ * **[eachIndex](#eachIndex)** ([code](lib/array.js#L77) | [tests](test/array.js#L58))
85
+ * **[filter](#filter)** ([code](lib/array.js#L102) | [tests](test/array.js#L91))
86
+ * **[first](#first)** ([code](lib/array.js#L142) | [tests](test/array.js#L65))
87
+ * **[forEach](#forEach)** ([code](lib/array.js#L184) | [tests](test/array.js#L123))
88
+ * **[inArray](#inArray)** ([code](lib/array.js#L224) | [tests](test/array.js#L160))
89
+ * **[isArray](#isArray)** ([code](lib/array.js#L244) | [tests](test/array.js#L172))
90
+ * **[itemAt](#itemAt)** ([code](lib/array.js#L263) | [tests](test/array.js#L182))
91
+ * **[join](#join)** ([code](lib/array.js#L294) | [tests](test/array.js#L225))
92
+ * **[equalsLength](#equalsLength)** ([code](lib/array.js#L313) | [no tests])
93
+ * **[last](#last)** ([code](lib/array.js#L349) | [tests](test/array.js#L240))
94
+ * **[length](#length)** ([code](lib/array.js#L379) | [tests](test/array.js#L254))
95
+ * **[lengthEqual](#lengthEqual)** ([code](lib/array.js#L395) | [tests](test/array.js#L254))
96
+ * **[map](#map)** ([code](lib/array.js#L414) | [tests](test/array.js#L266))
97
+ * **[pluck](#pluck)** ([code](lib/array.js#L445) | [tests](test/array.js#L300))
98
+ * **[reverse](#reverse)** ([code](lib/array.js#L473) | [no tests])
99
+ * **[some](#some)** ([code](lib/array.js#L504) | [tests](test/array.js#L308))
100
+ * **[sort](#sort)** ([code](lib/array.js#L532) | [tests](test/array.js#L333))
101
+ * **[sortBy](#sortBy)** ([code](lib/array.js#L557) | [tests](test/array.js#L358))
102
+ * **[withAfter](#withAfter)** ([code](lib/array.js#L588) | [tests](test/array.js#L390))
103
+ * **[withBefore](#withBefore)** ([code](lib/array.js#L618) | [tests](test/array.js#L397))
104
+ * **[withFirst](#withFirst)** ([code](lib/array.js#L648) | [tests](test/array.js#L404))
105
+ * **[withGroup](#withGroup)** ([code](lib/array.js#L692) | [tests](test/array.js#L418))
106
+ * **[withLast](#withLast)** ([code](lib/array.js#L727) | [tests](test/array.js#L428))
107
+ * **[withSort](#withSort)** ([code](lib/array.js#L766) | [tests](test/array.js#L442))
108
+ * **[unique](#unique)** ([code](lib/array.js#L816) | [tests](test/array.js#L483))
109
+
110
+ ### [code helpers](#code)
111
+
112
+ Visit the: [code](lib/code.js) | [unit tests](test/code.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+code+helpers))
113
+
114
+ * **[embed](#embed)** ([code](lib/code.js#L23) | [tests](test/code.js#L10))
115
+ * **[gist](#gist)** ([code](lib/code.js#L45) | [tests](test/code.js#L62))
116
+ * **[jsfiddle](#jsfiddle)** ([code](lib/code.js#L60) | [tests](test/code.js#L69))
117
+
118
+ ### [collection helpers](#collection)
119
+
120
+ Visit the: [code](lib/collection.js) | [unit tests](test/collection.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+collection+helpers))
121
+
122
+ * **[isEmpty](#isEmpty)** ([code](lib/collection.js#L31) | [tests](test/collection.js#L14))
123
+ * **[iterate](#iterate)** ([code](lib/collection.js#L59) | [tests](test/collection.js#L68))
124
+
125
+ ### [comparison helpers](#comparison)
126
+
127
+ Visit the: [code](lib/comparison.js) | [unit tests](test/comparison.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+comparison+helpers))
128
+
129
+ * **[and](#and)** ([code](lib/comparison.js#L27) | [tests](test/comparison.js#L10))
130
+ * **[compare](#compare)** ([code](lib/comparison.js#L57) | [tests](test/comparison.js#L41))
131
+ * **[contains](#contains)** ([code](lib/comparison.js#L124) | [tests](test/comparison.js#L167))
132
+ * **[default](#default)** ([code](lib/comparison.js#L143) | [tests](test/comparison.js#L204))
133
+ * **[eq](#eq)** ([code](lib/comparison.js#L165) | [tests](test/comparison.js#L351))
134
+ * **[gt](#gt)** ([code](lib/comparison.js#L188) | [tests](test/comparison.js#L214))
135
+ * **[gte](#gte)** ([code](lib/comparison.js#L212) | [tests](test/comparison.js#L245))
136
+ * **[has](#has)** ([code](lib/comparison.js#L232) | [tests](test/comparison.js#L260))
137
+ * **[isFalsey](#isFalsey)** ([code](lib/comparison.js#L274) | [tests](test/comparison.js#L327))
138
+ * **[isTruthy](#isTruthy)** ([code](lib/comparison.js#L289) | [tests](test/comparison.js#L339))
139
+ * **[ifEven](#ifEven)** ([code](lib/comparison.js#L310) | [tests](test/comparison.js#L368))
140
+ * **[ifNth](#ifNth)** ([code](lib/comparison.js#L327) | [tests](test/comparison.js#L380))
141
+ * **[ifOdd](#ifOdd)** ([code](lib/comparison.js#L350) | [tests](test/comparison.js#L403))
142
+ * **[is](#is)** ([code](lib/comparison.js#L274) | [tests](test/comparison.js#L327))
143
+ * **[isnt](#isnt)** ([code](lib/comparison.js#L389) | [tests](test/comparison.js#L432))
144
+ * **[lt](#lt)** ([code](lib/comparison.js#L411) | [tests](test/comparison.js#L449))
145
+ * **[lte](#lte)** ([code](lib/comparison.js#L435) | [tests](test/comparison.js#L476))
146
+ * **[neither](#neither)** ([code](lib/comparison.js#L456) | [tests](test/comparison.js#L511))
147
+ * **[not](#not)** ([code](lib/comparison.js#L470) | [no tests])
148
+ * **[or](#or)** ([code](lib/comparison.js#L492) | [tests](test/comparison.js#L523))
149
+ * **[unlessEq](#unlessEq)** ([code](lib/comparison.js#L518) | [tests](test/comparison.js#L556))
150
+ * **[unlessGt](#unlessGt)** ([code](lib/comparison.js#L538) | [tests](test/comparison.js#L567))
151
+ * **[unlessLt](#unlessLt)** ([code](lib/comparison.js#L558) | [tests](test/comparison.js#L578))
152
+ * **[unlessGteq](#unlessGteq)** ([code](lib/comparison.js#L578) | [tests](test/comparison.js#L589))
153
+ * **[unlessLteq](#unlessLteq)** ([code](lib/comparison.js#L598) | [tests](test/comparison.js#L604))
154
+
155
+ ### [date helpers](#date)
156
+
157
+ Visit the: [code](lib/date.js) | [unit tests](test/date.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+date+helpers))
158
+
159
+ * **[year](#year)** ([code](lib/date.js#L15) | [no tests])
160
+ * **[date](#date)** ([code](lib/date.js#Lundefined) | [no tests])
161
+ * **[moment](#moment)** ([code](lib/date.js#L24) | [no tests])
162
+
163
+ ### [fs helpers](#fs)
164
+
165
+ Visit the: [code](lib/fs.js) | [unit tests](test/fs.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+fs+helpers))
166
+
167
+ * **[fileSize](#fileSize)** ([code](lib/fs.js#L14) | [no tests])
168
+ * **[read](#read)** ([code](lib/fs.js#L29) | [tests](test/fs.js#L16))
169
+ * **[readdir](#readdir)** ([code](lib/fs.js#L42) | [tests](test/fs.js#L23))
170
+
171
+ ### [html helpers](#html)
172
+
173
+ Visit the: [code](lib/html.js) | [unit tests](test/html.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+html+helpers))
174
+
175
+ * **[attr](#attr)** ([code](lib/html.js#L23) | [tests](test/html.js#L13))
176
+ * **[css](#css)** ([code](lib/html.js#L45) | [tests](test/html.js#L21))
177
+ * **[js](#js)** ([code](lib/html.js#L89) | [tests](test/html.js#L69))
178
+ * **[sanitize](#sanitize)** ([code](lib/html.js#L121) | [tests](test/html.js#L98))
179
+ * **[ul](#ul)** ([code](lib/html.js#L135) | [tests](test/html.js#L108))
180
+ * **[ol](#ol)** ([code](lib/html.js#L154) | [tests](test/html.js#L115))
181
+ * **[thumbnailImage](#thumbnailImage)** ([code](lib/html.js#L176) | [tests](test/html.js#L122))
182
+
183
+ ### [i18n helpers](#i18n)
184
+
185
+ Visit the: [code](lib/i18n.js) | [unit tests](test/i18n.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+i18n+helpers))
186
+
187
+ * **[i18n](#i18n)** ([code](lib/i18n.js#L18) | [tests](test/i18n.js#L11))
188
+
189
+ ### [inflection helpers](#inflection)
190
+
191
+ Visit the: [code](lib/inflection.js) | [unit tests](test/inflection.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+inflection+helpers))
192
+
193
+ * **[inflect](#inflect)** ([code](lib/inflection.js#L30) | [tests](test/inflection.js#L9))
194
+ * **[ordinalize](#ordinalize)** ([code](lib/inflection.js#L58) | [tests](test/inflection.js#L22))
195
+
196
+ ### [logging helpers](#logging)
197
+
198
+ Visit the: [code](lib/logging.js) | [unit tests](test/logging.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+logging+helpers))
199
+
200
+ * **[log](#log)** ([code](lib/logging.js#Lundefined) | [no tests])
201
+ * **[ok](#ok)** ([code](lib/logging.js#Lundefined) | [no tests])
202
+ * **[success](#success)** ([code](lib/logging.js#Lundefined) | [no tests])
203
+ * **[info](#info)** ([code](lib/logging.js#Lundefined) | [no tests])
204
+ * **[warning](#warning)** ([code](lib/logging.js#Lundefined) | [no tests])
205
+ * **[warn](#warn)** ([code](lib/logging.js#Lundefined) | [no tests])
206
+ * **[error](#error)** ([code](lib/logging.js#Lundefined) | [no tests])
207
+ * **[danger](#danger)** ([code](lib/logging.js#Lundefined) | [no tests])
208
+ * **[bold](#bold)** ([code](lib/logging.js#Lundefined) | [no tests])
209
+ * **[_debug](#_debug)** ([code](lib/logging.js#Lundefined) | [no tests])
210
+ * **[_inspect](#_inspect)** ([code](lib/logging.js#Lundefined) | [no tests])
211
+
212
+ ### [markdown helpers](#markdown)
213
+
214
+ Visit the: [code](lib/markdown.js) | [unit tests](test/markdown.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+markdown+helpers))
215
+
216
+ * **[markdown](#markdown)** ([code](lib/markdown.js#Lundefined) | [tests](test/markdown.js#L10))
217
+ * **[md](#md)** ([code](lib/markdown.js#L55) | [tests](test/markdown.js#L18))
218
+
219
+ ### [match helpers](#match)
220
+
221
+ Visit the: [code](lib/match.js) | [unit tests](test/match.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+match+helpers))
222
+
223
+ * **[match](#match)** ([code](lib/match.js#L23) | [tests](test/match.js#L13))
224
+ * **[isMatch](#isMatch)** ([code](lib/match.js#L47) | [tests](test/match.js#L61))
225
+ * **[mm](#mm)** ([code](lib/match.js#L56) | [no tests])
226
+
227
+ ### [math helpers](#math)
228
+
229
+ Visit the: [code](lib/math.js) | [unit tests](test/math.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+math+helpers))
230
+
231
+ * **[abs](#abs)** ([code](lib/math.js#L15) | [no tests])
232
+ * **[add](#add)** ([code](lib/math.js#L31) | [tests](test/math.js#L10))
233
+ * **[avg](#avg)** ([code](lib/math.js#L54) | [no tests])
234
+ * **[ceil](#ceil)** ([code](lib/math.js#L69) | [tests](test/math.js#L29))
235
+ * **[divide](#divide)** ([code](lib/math.js#L84) | [tests](test/math.js#L36))
236
+ * **[floor](#floor)** ([code](lib/math.js#L102) | [tests](test/math.js#L43))
237
+ * **[minus](#minus)** ([code](lib/math.js#L118) | [no tests])
238
+ * **[modulo](#modulo)** ([code](lib/math.js#L137) | [no tests])
239
+ * **[multiply](#multiply)** ([code](lib/math.js#L157) | [tests](test/math.js#L50))
240
+ * **[plus](#plus)** ([code](lib/math.js#L175) | [no tests])
241
+ * **[random](#random)** ([code](lib/math.js#L194) | [tests](test/math.js#L102))
242
+ * **[remainder](#remainder)** ([code](lib/math.js#L212) | [tests](test/math.js#L57))
243
+ * **[round](#round)** ([code](lib/math.js#L224) | [tests](test/math.js#L69))
244
+ * **[subtract](#subtract)** ([code](lib/math.js#L241) | [tests](test/math.js#L76))
245
+ * **[sum](#sum)** ([code](lib/math.js#L263) | [tests](test/math.js#L83))
246
+ * **[times](#times)** ([code](lib/math.js#L286) | [no tests])
247
+
248
+ ### [misc helpers](#misc)
249
+
250
+ Visit the: [code](lib/misc.js) | [unit tests](test/misc.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+misc+helpers))
251
+
252
+ * **[frame](#frame)** ([code](lib/misc.js#L11) | [no tests])
253
+ * **[option](#option)** ([code](lib/misc.js#L26) | [tests](test/misc.js#L20))
254
+ * **[noop](#noop)** ([code](lib/misc.js#L39) | [tests](test/misc.js#L13))
255
+ * **[typeOf](#typeOf)** ([code](lib/misc.js#L59) | [no tests])
256
+ * **[withHash](#withHash)** ([code](lib/misc.js#L71) | [tests](test/misc.js#L38))
257
+
258
+ ### [number helpers](#number)
259
+
260
+ Visit the: [code](lib/number.js) | [unit tests](test/number.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+number+helpers))
261
+
262
+ * **[bytes](#bytes)** ([code](lib/number.js#L24) | [tests](test/number.js#L10))
263
+ * **[addCommas](#addCommas)** ([code](lib/number.js#L61) | [tests](test/number.js#L84))
264
+ * **[phoneNumber](#phoneNumber)** ([code](lib/number.js#L74) | [tests](test/number.js#L30))
265
+ * **[toAbbr](#toAbbr)** ([code](lib/number.js#L92) | [tests](test/number.js#L91))
266
+ * **[toExponential](#toExponential)** ([code](lib/number.js#L130) | [tests](test/number.js#L59))
267
+ * **[toFixed](#toFixed)** ([code](lib/number.js#L153) | [tests](test/number.js#L37))
268
+ * **[toFloat](#toFloat)** ([code](lib/number.js#L169) | [tests](test/number.js#L77))
269
+ * **[toInt](#toInt)** ([code](lib/number.js#L179) | [tests](test/number.js#L70))
270
+ * **[toPrecision](#toPrecision)** ([code](lib/number.js#L196) | [tests](test/number.js#L48))
271
+
272
+ ### [object helpers](#object)
273
+
274
+ Visit the: [code](lib/object.js) | [unit tests](test/object.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+object+helpers))
275
+
276
+ * **[extend](#extend)** ([code](lib/object.js#L18) | [tests](test/object.js#L15))
277
+ * **[forIn](#forIn)** ([code](lib/object.js#L55) | [tests](test/object.js#L33))
278
+ * **[forOwn](#forOwn)** ([code](lib/object.js#L81) | [tests](test/object.js#L50))
279
+ * **[toPath](#toPath)** ([code](lib/object.js#L106) | [tests](test/object.js#L87))
280
+ * **[get](#get)** ([code](lib/object.js#L128) | [tests](test/object.js#L77))
281
+ * **[getObject](#getObject)** ([code](lib/object.js#L149) | [tests](test/object.js#L77))
282
+ * **[hasOwn](#hasOwn)** ([code](lib/object.js#L167) | [tests](test/object.js#L126))
283
+ * **[isObject](#isObject)** ([code](lib/object.js#L183) | [tests](test/object.js#L144))
284
+ * **[JSONparse](#JSONparse)** ([code](lib/object.js#L201) | [tests](test/object.js#L164))
285
+ * **[JSONstringify](#JSONstringify)** ([code](lib/object.js#L218) | [no tests])
286
+ * **[merge](#merge)** ([code](lib/object.js#L235) | [tests](test/object.js#L156))
287
+ * **[parseJSON](#parseJSON)** ([code](lib/object.js#L254) | [no tests])
288
+ * **[pick](#pick)** ([code](lib/object.js#L267) | [tests](test/object.js#L171))
289
+ * **[stringify](#stringify)** ([code](lib/object.js#L290) | [tests](test/object.js#L199))
290
+
291
+ ### [path helpers](#path)
292
+
293
+ Visit the: [code](lib/path.js) | [unit tests](test/path.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+path+helpers))
294
+
295
+ * **[absolute](#absolute)** ([code](lib/path.js#L20) | [tests](test/path.js#L13))
296
+ * **[dirname](#dirname)** ([code](lib/path.js#L40) | [tests](test/path.js#L25))
297
+ * **[relative](#relative)** ([code](lib/path.js#L59) | [tests](test/path.js#L32))
298
+ * **[basename](#basename)** ([code](lib/path.js#L81) | [tests](test/path.js#L47))
299
+ * **[stem](#stem)** ([code](lib/path.js#L100) | [tests](test/path.js#L58))
300
+ * **[extname](#extname)** ([code](lib/path.js#L119) | [tests](test/path.js#L69))
301
+ * **[resolve](#resolve)** ([code](lib/path.js#L138) | [no tests])
302
+ * **[segments](#segments)** ([code](lib/path.js#L166) | [tests](test/path.js#L80))
303
+
304
+ ### [regex helpers](#regex)
305
+
306
+ Visit the: [code](lib/regex.js) | [unit tests](test/regex.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+regex+helpers))
307
+
308
+ * **[toRegex](#toRegex)** ([code](lib/regex.js#L19) | [no tests])
309
+ * **[test](#test)** ([code](lib/regex.js#L42) | [no tests])
310
+
311
+ ### [string helpers](#string)
312
+
313
+ Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+string+helpers))
314
+
315
+ * **[append](#append)** ([code](lib/string.js#L22) | [no tests])
316
+ * **[camelcase](#camelcase)** ([code](lib/string.js#L41) | [tests](test/string.js#L10))
317
+ * **[capitalize](#capitalize)** ([code](lib/string.js#L60) | [tests](test/string.js#L25))
318
+ * **[capitalizeAll](#capitalizeAll)** ([code](lib/string.js#L77) | [tests](test/string.js#L36))
319
+ * **[center](#center)** ([code](lib/string.js#L95) | [tests](test/string.js#L47))
320
+ * **[chop](#chop)** ([code](lib/string.js#L125) | [tests](test/string.js#L58))
321
+ * **[dashcase](#dashcase)** ([code](lib/string.js#L143) | [tests](test/string.js#L73))
322
+ * **[dotcase](#dotcase)** ([code](lib/string.js#L162) | [tests](test/string.js#L88))
323
+ * **[downcase](#downcase)** ([code](lib/string.js#L182) | [no tests])
324
+ * **[ellipsis](#ellipsis)** ([code](lib/string.js#L202) | [tests](test/string.js#L103))
325
+ * **[hyphenate](#hyphenate)** ([code](lib/string.js#L223) | [tests](test/string.js#L118))
326
+ * **[isString](#isString)** ([code](lib/string.js#L240) | [tests](test/string.js#L129))
327
+ * **[lowercase](#lowercase)** ([code](lib/string.js#L256) | [tests](test/string.js#L151))
328
+ * **[occurrences](#occurrences)** ([code](lib/string.js#L278) | [tests](test/string.js#L162))
329
+ * **[pascalcase](#pascalcase)** ([code](lib/string.js#L303) | [tests](test/string.js#L173))
330
+ * **[pathcase](#pathcase)** ([code](lib/string.js#L323) | [tests](test/string.js#L188))
331
+ * **[plusify](#plusify)** ([code](lib/string.js#L343) | [tests](test/string.js#L203))
332
+ * **[prepend](#prepend)** ([code](lib/string.js#L363) | [no tests])
333
+ * **[raw](#raw)** ([code](lib/string.js#L385) | [no tests])
334
+ * **[remove](#remove)** ([code](lib/string.js#L413) | [no tests])
335
+ * **[removeFirst](#removeFirst)** ([code](lib/string.js#L432) | [no tests])
336
+ * **[replace](#replace)** ([code](lib/string.js#L452) | [tests](test/string.js#L222))
337
+ * **[replaceFirst](#replaceFirst)** ([code](lib/string.js#L473) | [no tests])
338
+ * **[reverse](#reverse)** ([code](lib/string.js#L492) | [tests](test/string.js#L241))
339
+ * **[sentence](#sentence)** ([code](lib/string.js#L509) | [tests](test/string.js#L252))
340
+ * **[snakecase](#snakecase)** ([code](lib/string.js#L528) | [tests](test/string.js#L263))
341
+ * **[split](#split)** ([code](lib/string.js#L547) | [tests](test/string.js#L278))
342
+ * **[startsWith](#startsWith)** ([code](lib/string.js#L572) | [tests](test/string.js#L293))
343
+ * **[titleize](#titleize)** ([code](lib/string.js#L596) | [tests](test/string.js#L312))
344
+ * **[trim](#trim)** ([code](lib/string.js#L623) | [tests](test/string.js#L323))
345
+ * **[trimLeft](#trimLeft)** ([code](lib/string.js#L639) | [no tests])
346
+ * **[trimRight](#trimRight)** ([code](lib/string.js#L657) | [no tests])
347
+ * **[truncate](#truncate)** ([code](lib/string.js#L680) | [tests](test/string.js#L338))
348
+ * **[truncateWords](#truncateWords)** ([code](lib/string.js#L712) | [no tests])
349
+ * **[upcase](#upcase)** ([code](lib/string.js#L742) | [no tests])
350
+ * **[uppercase](#uppercase)** ([code](lib/string.js#L763) | [tests](test/string.js#L362))
351
+
352
+ ### [url helpers](#url)
353
+
354
+ Visit the: [code](lib/url.js) | [unit tests](test/url.js) | [issues](https://github.com/jonathas/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+url+helpers))
355
+
356
+ * **[encodeURI](#encodeURI)** ([code](lib/url.js#L19) | [tests](test/url.js#L31))
357
+ * **[escape](#escape)** ([code](lib/url.js#L34) | [no tests])
358
+ * **[decodeURI](#decodeURI)** ([code](lib/url.js#L48) | [tests](test/url.js#L38))
359
+ * **[url_encode](#url_encode)** ([code](lib/url.js#L59) | [no tests])
360
+ * **[url_decode](#url_decode)** ([code](lib/url.js#L68) | [no tests])
361
+ * **[urlResolve](#urlResolve)** ([code](lib/url.js#L82) | [tests](test/url.js#L11))
362
+ * **[urlParse](#urlParse)** ([code](lib/url.js#L94) | [tests](test/url.js#L45))
363
+ * **[stripQuerystring](#stripQuerystring)** ([code](lib/url.js#L106) | [tests](test/url.js#L24))
364
+ * **[stripProtocol](#stripProtocol)** ([code](lib/url.js#L126) | [no tests])
365
+
366
+ ***
367
+
368
+ ## array
369
+
370
+ ### [{{after}}](lib/array.js#L22)
371
+
372
+ Returns all of the items in an array after the specified index. Opposite of [before](#before).
373
+
374
+ **Params**
375
+
376
+ * `array` **{Array}**: Collection
377
+ * `n` **{Number}**: Starting index (number of items to exclude)
378
+ * `returns` **{Array}**: Array exluding `n` items.
379
+
380
+ **Example**
381
+
382
+ ```handlebars
383
+ <!-- array: ['a', 'b', 'c'] -->
384
+ {{after array 1}}
385
+ <!-- results in: '["c"]' -->
386
+ ```
387
+
388
+ ### [{{arrayify}}](lib/array.js#L39)
389
+
390
+ Cast the given `value` to an array.
391
+
392
+ **Params**
393
+
394
+ * `value` **{any}**
395
+ * `returns` **{Array}**
396
+
397
+ **Example**
398
+
399
+ ```handlebars
400
+ {{arrayify "foo"}}
401
+ <!-- results in: [ "foo" ] -->
402
+ ```
403
+
404
+ ### [{{before}}](lib/array.js#L58)
405
+
406
+ Return all of the items in the collection before the specified count. Opposite of [after](#after).
407
+
408
+ **Params**
409
+
410
+ * `array` **{Array}**
411
+ * `n` **{Number}**
412
+ * `returns` **{Array}**: Array excluding items after the given number.
413
+
414
+ **Example**
415
+
416
+ ```handlebars
417
+ <!-- array: ['a', 'b', 'c'] -->
418
+ {{before array 2}}
419
+ <!-- results in: '["a", "b"]' -->
420
+ ```
421
+
422
+ ### [{{eachIndex}}](lib/array.js#L77)
423
+
424
+ **Params**
425
+
426
+ * `array` **{Array}**
427
+ * `options` **{Object}**
428
+ * `returns` **{String}**
429
+
430
+ **Example**
431
+
432
+ ```handlebars
433
+ <!-- array: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] -->
434
+ {{#eachIndex array}}
435
+ {{item}} is {{index}}
436
+ {{/eachIndex}}
437
+ ```
438
+
439
+ ### [{{filter}}](lib/array.js#L102)
440
+
441
+ Block helper that filters the given array and renders the block for values that evaluate to `true`, otherwise the inverse block is returned.
442
+
443
+ **Params**
444
+
445
+ * `array` **{Array}**
446
+ * `value` **{any}**
447
+ * `options` **{Object}**
448
+ * `returns` **{String}**
449
+
450
+ **Example**
451
+
452
+ ```handlebars
453
+ <!-- array: ['a', 'b', 'c'] -->
454
+ {{#filter array "foo"}}AAA{{else}}BBB{{/filter}}
455
+ <!-- results in: 'BBB' -->
456
+ ```
457
+
458
+ ### [{{first}}](lib/array.js#L142)
459
+
460
+ Returns the first item, or first `n` items of an array.
461
+
462
+ **Params**
463
+
464
+ * `array` **{Array}**
465
+ * `n` **{Number}**: Number of items to return, starting at `0`.
466
+ * `returns` **{Array}**
467
+
468
+ **Example**
469
+
470
+ ```handlebars
471
+ {{first "['a', 'b', 'c', 'd', 'e']" 2}}
472
+ <!-- results in: '["a", "b"]' -->
473
+ ```
474
+
475
+ ### [{{forEach}}](lib/array.js#L184)
476
+
477
+ Iterates over each item in an array and exposes the current item in the array as context to the inner block. In addition to the current array item, the helper exposes the following variables to the inner block:
478
+
479
+ * `index`
480
+ * `total`
481
+ * `isFirst`
482
+ * `isLast`
483
+ Also, `@index` is exposed as a private variable, and additional
484
+ private variables may be defined as hash arguments.
485
+
486
+ **Params**
487
+
488
+ * `array` **{Array}**
489
+ * `returns` **{String}**
490
+
491
+ **Example**
492
+
493
+ ```handlebars
494
+ <!-- accounts = [
495
+ {'name': 'John', 'email': 'john@example.com'},
496
+ {'name': 'Malcolm', 'email': 'malcolm@example.com'},
497
+ {'name': 'David', 'email': 'david@example.com'}
498
+ ] -->
499
+
500
+ {{#forEach accounts}}
501
+ <a href="mailto:{{ email }}" title="Send an email to {{ name }}">
502
+ {{ name }}
503
+ </a>{{#unless isLast}}, {{/unless}}
504
+ {{/forEach}}
505
+ ```
506
+
507
+ ### [{{inArray}}](lib/array.js#L224)
508
+
509
+ Block helper that renders the block if an array has the given `value`. Optionally specify an inverse block to render when the array does not have the given value.
510
+
511
+ **Params**
512
+
513
+ * `array` **{Array}**
514
+ * `value` **{any}**
515
+ * `options` **{Object}**
516
+ * `returns` **{String}**
517
+
518
+ **Example**
519
+
520
+ ```handlebars
521
+ <!-- array: ['a', 'b', 'c'] -->
522
+ {{#inArray array "d"}}
523
+ foo
524
+ {{else}}
525
+ bar
526
+ {{/inArray}}
527
+ <!-- results in: 'bar' -->
528
+ ```
529
+
530
+ ### [{{isArray}}](lib/array.js#L244)
531
+
532
+ Returns true if `value` is an es5 array.
533
+
534
+ **Params**
535
+
536
+ * `value` **{any}**: The value to test.
537
+ * `returns` **{Boolean}**
538
+
539
+ **Example**
540
+
541
+ ```handlebars
542
+ {{isArray "abc"}}
543
+ <!-- results in: false -->
544
+
545
+ <!-- array: [1, 2, 3] -->
546
+ {{isArray array}}
547
+ <!-- results in: true -->
548
+ ```
549
+
550
+ ### [{{itemAt}}](lib/array.js#L263)
551
+
552
+ Returns the item from `array` at index `idx`.
553
+
554
+ **Params**
555
+
556
+ * `array` **{Array}**
557
+ * `idx` **{Number}**
558
+ * `returns` **{any}** `value`
559
+
560
+ **Example**
561
+
562
+ ```handlebars
563
+ <!-- array: ['a', 'b', 'c'] -->
564
+ {{itemAt array 1}}
565
+ <!-- results in: 'b' -->
566
+ ```
567
+
568
+ ### [{{join}}](lib/array.js#L294)
569
+
570
+ Join all elements of array into a string, optionally using a given separator.
571
+
572
+ **Params**
573
+
574
+ * `array` **{Array}**
575
+ * `separator` **{String}**: The separator to use. Defaults to `,`.
576
+ * `returns` **{String}**
577
+
578
+ **Example**
579
+
580
+ ```handlebars
581
+ <!-- array: ['a', 'b', 'c'] -->
582
+ {{join array}}
583
+ <!-- results in: 'a, b, c' -->
584
+
585
+ {{join array '-'}}
586
+ <!-- results in: 'a-b-c' -->
587
+ ```
588
+
589
+ ### [{{equalsLength}}](lib/array.js#L313)
590
+
591
+ Returns true if the the length of the given `value` is equal
592
+ to the given `length`. Can be used as a block or inline helper.
593
+
594
+ **Params**
595
+
596
+ * `value` **{Array|String}**
597
+ * `length` **{Number}**
598
+ * `options` **{Object}**
599
+ * `returns` **{String}**
600
+
601
+ ### [{{last}}](lib/array.js#L349)
602
+
603
+ Returns the last item, or last `n` items of an array or string. Opposite of [first](#first).
604
+
605
+ **Params**
606
+
607
+ * `value` **{Array|String}**: Array or string.
608
+ * `n` **{Number}**: Number of items to return from the end of the array.
609
+ * `returns` **{Array}**
610
+
611
+ **Example**
612
+
613
+ ```handlebars
614
+ <!-- var value = ['a', 'b', 'c', 'd', 'e'] -->
615
+
616
+ {{last value}}
617
+ <!-- results in: ['e'] -->
618
+
619
+ {{last value 2}}
620
+ <!-- results in: ['d', 'e'] -->
621
+
622
+ {{last value 3}}
623
+ <!-- results in: ['c', 'd', 'e'] -->
624
+ ```
625
+
626
+ ### [{{length}}](lib/array.js#L379)
627
+
628
+ Returns the length of the given string or array.
629
+
630
+ **Params**
631
+
632
+ * `value` **{Array|Object|String}**
633
+ * `returns` **{Number}**: The length of the value.
634
+
635
+ **Example**
636
+
637
+ ```handlebars
638
+ {{length '["a", "b", "c"]'}}
639
+ <!-- results in: 3 -->
640
+
641
+ <!-- results in: myArray = ['a', 'b', 'c', 'd', 'e']; -->
642
+ {{length myArray}}
643
+ <!-- results in: 5 -->
644
+
645
+ <!-- results in: myObject = {'a': 'a', 'b': 'b'}; -->
646
+ {{length myObject}}
647
+ <!-- results in: 2 -->
648
+ ```
649
+
650
+ ### [{{lengthEqual}}](lib/array.js#L395)
651
+
652
+ Alias for [equalsLength](#equalsLength)
653
+
654
+ ### [{{map}}](lib/array.js#L414)
655
+
656
+ Returns a new array, created by calling `function` on each element of the given `array`. For example,
657
+
658
+ **Params**
659
+
660
+ * `array` **{Array}**
661
+ * `fn` **{Function}**
662
+ * `returns` **{String}**
663
+
664
+ **Example**
665
+
666
+ ```handlebars
667
+ <!-- array: ['a', 'b', 'c'], and "double" is a
668
+ fictitious function that duplicates letters -->
669
+ {{map array double}}
670
+ <!-- results in: '["aa", "bb", "cc"]' -->
671
+ ```
672
+
673
+ ### [{{pluck}}](lib/array.js#L445)
674
+
675
+ Map over the given object or array or objects and create an array of values from the given `prop`. Dot-notation may be used (as a string) to get nested properties.
676
+
677
+ **Params**
678
+
679
+ * `collection` **{Array|Object}**
680
+ * `prop` **{Function}**
681
+ * `returns` **{String}**
682
+
683
+ **Example**
684
+
685
+ ```handlebars
686
+ // {{pluck items "data.title"}}
687
+ <!-- results in: '["aa", "bb", "cc"]' -->
688
+ ```
689
+
690
+ ### [{{reverse}}](lib/array.js#L473)
691
+
692
+ Reverse the elements in an array, or the characters in a string.
693
+
694
+ **Params**
695
+
696
+ * `value` **{Array|String}**
697
+ * `returns` **{Array|String}**: Returns the reversed string or array.
698
+
699
+ **Example**
700
+
701
+ ```handlebars
702
+ <!-- value: 'abcd' -->
703
+ {{reverse value}}
704
+ <!-- results in: 'dcba' -->
705
+ <!-- value: ['a', 'b', 'c', 'd'] -->
706
+ {{reverse value}}
707
+ <!-- results in: ['d', 'c', 'b', 'a'] -->
708
+ ```
709
+
710
+ ### [{{some}}](lib/array.js#L504)
711
+
712
+ Block helper that returns the block if the callback returns true for some value in the given array.
713
+
714
+ **Params**
715
+
716
+ * `array` **{Array}**
717
+ * `iter` **{Function}**: Iteratee
718
+ * **{Options}**: Handlebars provided options object
719
+ * `returns` **{String}**
720
+
721
+ **Example**
722
+
723
+ ```handlebars
724
+ <!-- array: [1, 'b', 3] -->
725
+ {{#some array isString}}
726
+ Render me if the array has a string.
727
+ {{else}}
728
+ Render me if it doesn't.
729
+ {{/some}}
730
+ <!-- results in: 'Render me if the array has a string.' -->
731
+ ```
732
+
733
+ ### [{{sort}}](lib/array.js#L532)
734
+
735
+ Sort the given `array`. If an array of objects is passed, you may optionally pass a `key` to sort on as the second argument. You may alternatively pass a sorting function as the second argument.
736
+
737
+ **Params**
738
+
739
+ * `array` **{Array}**: the array to sort.
740
+ * `key` **{String|Function}**: The object key to sort by, or sorting function.
741
+
742
+ **Example**
743
+
744
+ ```handlebars
745
+ <!-- array: ['b', 'a', 'c'] -->
746
+ {{sort array}}
747
+ <!-- results in: '["a", "b", "c"]' -->
748
+ ```
749
+
750
+ ### [{{sortBy}}](lib/array.js#L557)
751
+
752
+ Sort an `array`. If an array of objects is passed, you may optionally pass a `key` to sort on as the second argument. You may alternatively pass a sorting function as the second argument.
753
+
754
+ **Params**
755
+
756
+ * `array` **{Array}**: the array to sort.
757
+ * `props` **{String|Function}**: One or more properties to sort by, or sorting functions to use.
758
+
759
+ **Example**
760
+
761
+ ```handlebars
762
+ <!-- array: [{a: 'zzz'}, {a: 'aaa'}] -->
763
+ {{sortBy array "a"}}
764
+ <!-- results in: '[{"a":"aaa"}, {"a":"zzz"}]' -->
765
+ ```
766
+
767
+ ### [{{withAfter}}](lib/array.js#L588)
768
+
769
+ Use the items in the array _after_ the specified index as context inside a block. Opposite of [withBefore](#withBefore).
770
+
771
+ **Params**
772
+
773
+ * `array` **{Array}**
774
+ * `idx` **{Number}**
775
+ * `options` **{Object}**
776
+ * `returns` **{Array}**
777
+
778
+ **Example**
779
+
780
+ ```handlebars
781
+ <!-- array: ['a', 'b', 'c', 'd', 'e'] -->
782
+ {{#withAfter array 3}}
783
+ {{this}}
784
+ {{/withAfter}}
785
+ <!-- results in: "de" -->
786
+ ```
787
+
788
+ ### [{{withBefore}}](lib/array.js#L618)
789
+
790
+ Use the items in the array _before_ the specified index as context inside a block. Opposite of [withAfter](#withAfter).
791
+
792
+ **Params**
793
+
794
+ * `array` **{Array}**
795
+ * `idx` **{Number}**
796
+ * `options` **{Object}**
797
+ * `returns` **{Array}**
798
+
799
+ **Example**
800
+
801
+ ```handlebars
802
+ <!-- array: ['a', 'b', 'c', 'd', 'e'] -->
803
+ {{#withBefore array 3}}
804
+ {{this}}
805
+ {{/withBefore}}
806
+ <!-- results in: 'ab' -->
807
+ ```
808
+
809
+ ### [{{withFirst}}](lib/array.js#L648)
810
+
811
+ Use the first item in a collection inside a handlebars block expression. Opposite of [withLast](#withLast).
812
+
813
+ **Params**
814
+
815
+ * `array` **{Array}**
816
+ * `idx` **{Number}**
817
+ * `options` **{Object}**
818
+ * `returns` **{String}**
819
+
820
+ **Example**
821
+
822
+ ```handlebars
823
+ <!-- array: ['a', 'b', 'c'] -->
824
+ {{#withFirst array}}
825
+ {{this}}
826
+ {{/withFirst}}
827
+ <!-- results in: 'a' -->
828
+ ```
829
+
830
+ ### [{{withGroup}}](lib/array.js#L692)
831
+
832
+ Block helper that groups array elements by given group `size`.
833
+
834
+ **Params**
835
+
836
+ * `array` **{Array}**: The array to iterate over
837
+ * `size` **{Number}**: The desired length of each array "group"
838
+ * `options` **{Object}**: Handlebars options
839
+ * `returns` **{String}**
840
+
841
+ **Example**
842
+
843
+ ```handlebars
844
+ <!-- array: ['a','b','c','d','e','f','g','h'] -->
845
+ {{#withGroup array 4}}
846
+ {{#each this}}
847
+ {{.}}
848
+ {{each}}
849
+ <br>
850
+ {{/withGroup}}
851
+ <!-- results in: -->
852
+ <!-- 'a','b','c','d'<br> -->
853
+ <!-- 'e','f','g','h'<br> -->
854
+ ```
855
+
856
+ ### [{{withLast}}](lib/array.js#L727)
857
+
858
+ Use the last item or `n` items in an array as context inside a block. Opposite of [withFirst](#withFirst).
859
+
860
+ **Params**
861
+
862
+ * `array` **{Array}**
863
+ * `idx` **{Number}**: The starting index.
864
+ * `options` **{Object}**
865
+ * `returns` **{String}**
866
+
867
+ **Example**
868
+
869
+ ```handlebars
870
+ <!-- array: ['a', 'b', 'c'] -->
871
+ {{#withLast array}}
872
+ {{this}}
873
+ {{/withLast}}
874
+ <!-- results in: 'c' -->
875
+ ```
876
+
877
+ ### [{{withSort}}](lib/array.js#L766)
878
+
879
+ Block helper that sorts a collection and exposes the sorted collection as context inside the block.
880
+
881
+ **Params**
882
+
883
+ * `array` **{Array}**
884
+ * `prop` **{String}**
885
+ * `options` **{Object}**: Specify `reverse="true"` to reverse the array.
886
+ * `returns` **{String}**
887
+
888
+ **Example**
889
+
890
+ ```handlebars
891
+ <!-- array: ['b', 'a', 'c'] -->
892
+ {{#withSort array}}{{this}}{{/withSort}}
893
+ <!-- results in: 'abc' -->
894
+ ```
895
+
896
+ ### [{{unique}}](lib/array.js#L816)
897
+
898
+ Block helper that return an array with all duplicate values removed. Best used along with a [each](#each) helper.
899
+
900
+ **Params**
901
+
902
+ * `array` **{Array}**
903
+ * `options` **{Object}**
904
+ * `returns` **{Array}**
905
+
906
+ **Example**
907
+
908
+ ```handlebars
909
+ <!-- array: ['a', 'a', 'c', 'b', 'e', 'e'] -->
910
+ {{#each (unique array)}}{{.}}{{/each}}
911
+ <!-- results in: 'acbe' -->
912
+ ```
913
+
914
+ ## code
915
+
916
+ ### [{{embed}}](lib/code.js#L23)
917
+
918
+ Embed code from an external file as preformatted text.
919
+
920
+ **Params**
921
+
922
+ * `filepath` **{String}**: filepath to the file to embed.
923
+ * `language` **{String}**: Optionally specify the language to use for syntax highlighting.
924
+ * `returns` **{String}**
925
+
926
+ **Example**
927
+
928
+ ```handlebars
929
+ {{embed 'path/to/file.js'}}
930
+ <!-- optionally specify the language to use -->
931
+ {{embed 'path/to/file.hbs' 'html')}}
932
+ ```
933
+
934
+ ### [{{gist}}](lib/code.js#L45)
935
+
936
+ Embed a GitHub Gist using only the id of the Gist
937
+
938
+ **Params**
939
+
940
+ * `id` **{String}**
941
+ * `returns` **{String}**
942
+
943
+ **Example**
944
+
945
+ ```handlebars
946
+ {{gist "12345"}}
947
+ ```
948
+
949
+ ### [{{jsfiddle}}](lib/code.js#L60)
950
+
951
+ Generate the HTML for a jsFiddle link with the given `params`
952
+
953
+ **Params**
954
+
955
+ * `params` **{Object}**
956
+ * `returns` **{String}**
957
+
958
+ **Example**
959
+
960
+ ```handlebars
961
+ {{jsfiddle id="0dfk10ks" tabs="true"}}
962
+ ```
963
+
964
+ ## collection
965
+
966
+ ### [{{isEmpty}}](lib/collection.js#L31)
967
+
968
+ Inline, subexpression, or block helper that returns true (or the block) if the given collection is empty, or false (or the inverse block, if supplied) if the colleciton is not empty.
969
+
970
+ **Params**
971
+
972
+ * `collection` **{Object}**
973
+ * `options` **{Object}**
974
+ * `returns` **{String}**
975
+
976
+ **Example**
977
+
978
+ ```handlebars
979
+ <!-- array: [] -->
980
+ {{#isEmpty array}}AAA{{else}}BBB{{/isEmpty}}
981
+ <!-- results in: 'AAA' -->
982
+
983
+ <!-- array: [] -->
984
+ {{isEmpty array}}
985
+ <!-- results in: true -->
986
+ ```
987
+
988
+ ### [{{iterate}}](lib/collection.js#L59)
989
+
990
+ Block helper that iterates over an array or object. If
991
+ an array is given, `.forEach` is called, or if an object
992
+ is given, `.forOwn` is called, otherwise the inverse block
993
+ is returned.
994
+
995
+ **Params**
996
+
997
+ * `collection` **{Object|Array}**: The collection to iterate over
998
+ * `options` **{Object}**
999
+ * `returns` **{String}**
1000
+
1001
+ ## comparison
1002
+
1003
+ ### [{{and}}](lib/comparison.js#L27)
1004
+
1005
+ Helper that renders the block if **both** of the given values are truthy. If an inverse block is specified it will be rendered when falsy. Works as a block helper, inline helper or subexpression.
1006
+
1007
+ **Params**
1008
+
1009
+ * `a` **{any}**
1010
+ * `b` **{any}**
1011
+ * `options` **{Object}**: Handlebars provided options object
1012
+ * `returns` **{String}**
1013
+
1014
+ **Example**
1015
+
1016
+ ```handlebars
1017
+ <!-- {great: true, magnificent: true} -->
1018
+ {{#and great magnificent}}A{{else}}B{{/and}}
1019
+ <!-- results in: 'A' -->
1020
+ ```
1021
+
1022
+ ### [{{compare}}](lib/comparison.js#L57)
1023
+
1024
+ Render a block when a comparison of the first and third
1025
+ arguments returns true. The second argument is
1026
+ the [arithemetic operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators) to use. You may also
1027
+ optionally specify an inverse block to render when falsy.
1028
+
1029
+ **Params**
1030
+
1031
+ * `a` **{}**
1032
+ * `operator` **{}**: The operator to use. Operators must be enclosed in quotes: `">"`, `"="`, `"<="`, and so on.
1033
+ * `b` **{}**
1034
+ * `options` **{Object}**: Handlebars provided options object
1035
+ * `returns` **{String}**: Block, or if specified the inverse block is rendered if falsey.
1036
+
1037
+ ### [{{contains}}](lib/comparison.js#L124)
1038
+
1039
+ Block helper that renders the block if `collection` has the given `value`, using strict equality (`===`) for comparison, otherwise the inverse block is rendered (if specified). If a `startIndex` is specified and is negative, it is used as the offset from the end of the collection.
1040
+
1041
+ **Params**
1042
+
1043
+ * `collection` **{Array|Object|String}**: The collection to iterate over.
1044
+ * `value` **{any}**: The value to check for.
1045
+ * `[startIndex=0]` **{Number}**: Optionally define the starting index.
1046
+ * `options` **{Object}**: Handlebars provided options object.
1047
+
1048
+ **Example**
1049
+
1050
+ ```handlebars
1051
+ <!-- array = ['a', 'b', 'c'] -->
1052
+ {{#contains array "d"}}
1053
+ This will not be rendered.
1054
+ {{else}}
1055
+ This will be rendered.
1056
+ {{/contains}}
1057
+ ```
1058
+
1059
+ ### [{{default}}](lib/comparison.js#L143)
1060
+
1061
+ Returns the first value that is not undefined, otherwise the "default" value is returned.
1062
+
1063
+ **Params**
1064
+
1065
+ * `value` **{any}**
1066
+ * `defaultValue` **{any}**
1067
+ * `returns` **{String}**
1068
+
1069
+ ### [{{eq}}](lib/comparison.js#L165)
1070
+
1071
+ Block helper that renders a block if `a` is **equal to** `b`.
1072
+ If an inverse block is specified it will be rendered when falsy.
1073
+ You may optionally use the `compare=""` hash argument for the
1074
+ second value.
1075
+
1076
+ **Params**
1077
+
1078
+ * `a` **{String}**
1079
+ * `b` **{String}**
1080
+ * `options` **{Object}**: Handlebars provided options object
1081
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1082
+
1083
+ ### [{{gt}}](lib/comparison.js#L188)
1084
+
1085
+ Block helper that renders a block if `a` is **greater than** `b`.
1086
+
1087
+ If an inverse block is specified it will be rendered when falsy.
1088
+ You may optionally use the `compare=""` hash argument for the
1089
+ second value.
1090
+
1091
+ **Params**
1092
+
1093
+ * `a` **{String}**
1094
+ * `b` **{String}**
1095
+ * `options` **{Object}**: Handlebars provided options object
1096
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1097
+
1098
+ ### [{{gte}}](lib/comparison.js#L212)
1099
+
1100
+ Block helper that renders a block if `a` is **greater than or equal to** `b`.
1101
+
1102
+ If an inverse block is specified it will be rendered when falsy.
1103
+ You may optionally use the `compare=""` hash argument for the
1104
+ second value.
1105
+
1106
+ **Params**
1107
+
1108
+ * `a` **{String}**
1109
+ * `b` **{String}**
1110
+ * `options` **{Object}**: Handlebars provided options object
1111
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1112
+
1113
+ ### [{{has}}](lib/comparison.js#L232)
1114
+
1115
+ Block helper that renders a block if `value` has `pattern`.
1116
+ If an inverse block is specified it will be rendered when falsy.
1117
+
1118
+ **Params**
1119
+
1120
+ * `val` **{any}**: The value to check.
1121
+ * `pattern` **{any}**: The pattern to check for.
1122
+ * `options` **{Object}**: Handlebars provided options object
1123
+ * `returns` **{String}**
1124
+
1125
+ ### [{{isFalsey}}](lib/comparison.js#L274)
1126
+
1127
+ Returns true if the given `value` is falsey. Uses the [falsey](https://github.com/jonschlinkert/falsey)
1128
+ library for comparisons. Please see that library for more information
1129
+ or to report bugs with this helper.
1130
+
1131
+ **Params**
1132
+
1133
+ * `val` **{any}**
1134
+ * `options` **{Options}**
1135
+ * `returns` **{Boolean}**
1136
+
1137
+ ### [{{isTruthy}}](lib/comparison.js#L289)
1138
+
1139
+ Returns true if the given `value` is truthy. Uses the [falsey](https://github.com/jonschlinkert/falsey)
1140
+ library for comparisons. Please see that library for more information
1141
+ or to report bugs with this helper.
1142
+
1143
+ **Params**
1144
+
1145
+ * `val` **{any}**
1146
+ * `options` **{Options}**
1147
+ * `returns` **{Boolean}**
1148
+
1149
+ ### [{{ifEven}}](lib/comparison.js#L310)
1150
+
1151
+ Return true if the given value is an even number.
1152
+
1153
+ **Params**
1154
+
1155
+ * `number` **{Number}**
1156
+ * `options` **{Object}**: Handlebars provided options object
1157
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1158
+
1159
+ **Example**
1160
+
1161
+ ```handlebars
1162
+ {{#ifEven value}}
1163
+ render A
1164
+ {{else}}
1165
+ render B
1166
+ {{/ifEven}}
1167
+ ```
1168
+
1169
+ ### [{{ifNth}}](lib/comparison.js#L327)
1170
+
1171
+ Conditionally renders a block if the remainder is zero when
1172
+ `a` operand is divided by `b`. If an inverse block is specified
1173
+ it will be rendered when the remainder is **not zero**.
1174
+
1175
+ **Params**
1176
+
1177
+ * **{}**: {Number}
1178
+ * **{}**: {Number}
1179
+ * `options` **{Object}**: Handlebars provided options object
1180
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1181
+
1182
+ ### [{{ifOdd}}](lib/comparison.js#L350)
1183
+
1184
+ Block helper that renders a block if `value` is **an odd number**. If an inverse block is specified it will be rendered when falsy.
1185
+
1186
+ **Params**
1187
+
1188
+ * `value` **{Object}**
1189
+ * `options` **{Object}**: Handlebars provided options object
1190
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1191
+
1192
+ **Example**
1193
+
1194
+ ```handlebars
1195
+ {{#ifOdd value}}
1196
+ render A
1197
+ {{else}}
1198
+ render B
1199
+ {{/ifOdd}}
1200
+ ```
1201
+
1202
+ ### [{{is}}](lib/comparison.js#L367)
1203
+
1204
+ Block helper that renders a block if `a` is **equal to** `b`.
1205
+ If an inverse block is specified it will be rendered when falsy.
1206
+ Similar to [eq](#eq) but does not do strict equality.
1207
+
1208
+ **Params**
1209
+
1210
+ * `a` **{any}**
1211
+ * `b` **{any}**
1212
+ * `options` **{Object}**: Handlebars provided options object
1213
+ * `returns` **{String}**
1214
+
1215
+ ### [{{isnt}}](lib/comparison.js#L389)
1216
+
1217
+ Block helper that renders a block if `a` is **not equal to** `b`.
1218
+ If an inverse block is specified it will be rendered when falsy.
1219
+ Similar to [unlessEq](#unlesseq) but does not use strict equality for
1220
+ comparisons.
1221
+
1222
+ **Params**
1223
+
1224
+ * `a` **{String}**
1225
+ * `b` **{String}**
1226
+ * `options` **{Object}**: Handlebars provided options object
1227
+ * `returns` **{String}**
1228
+
1229
+ ### [{{lt}}](lib/comparison.js#L411)
1230
+
1231
+ Block helper that renders a block if `a` is **less than** `b`.
1232
+
1233
+ If an inverse block is specified it will be rendered when falsy.
1234
+ You may optionally use the `compare=""` hash argument for the
1235
+ second value.
1236
+
1237
+ **Params**
1238
+
1239
+ * `context` **{Object}**
1240
+ * `options` **{Object}**: Handlebars provided options object
1241
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1242
+
1243
+ ### [{{lte}}](lib/comparison.js#L435)
1244
+
1245
+ Block helper that renders a block if `a` is **less than or equal to** `b`.
1246
+
1247
+ If an inverse block is specified it will be rendered when falsy.
1248
+ You may optionally use the `compare=""` hash argument for the
1249
+ second value.
1250
+
1251
+ **Params**
1252
+
1253
+ * `a` **{Sring}**
1254
+ * `b` **{Sring}**
1255
+ * `options` **{Object}**: Handlebars provided options object
1256
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1257
+
1258
+ ### [{{neither}}](lib/comparison.js#L456)
1259
+
1260
+ Block helper that renders a block if **neither of** the given values
1261
+ are truthy. If an inverse block is specified it will be rendered
1262
+ when falsy.
1263
+
1264
+ **Params**
1265
+
1266
+ * `a` **{any}**
1267
+ * `b` **{any}**
1268
+ * `options` **{}**: Handlebars options object
1269
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1270
+
1271
+ ### [{{not}}](lib/comparison.js#L470)
1272
+
1273
+ Returns true if `val` is falsey. Works as a block or inline helper.
1274
+
1275
+ **Params**
1276
+
1277
+ * `val` **{String}**
1278
+ * `options` **{Object}**: Handlebars provided options object
1279
+ * `returns` **{String}**
1280
+
1281
+ ### [{{or}}](lib/comparison.js#L492)
1282
+
1283
+ Block helper that renders a block if **any of** the given values is truthy. If an inverse block is specified it will be rendered when falsy.
1284
+
1285
+ **Params**
1286
+
1287
+ * `arguments` **{...any}**: Variable number of arguments
1288
+ * `options` **{Object}**: Handlebars options object
1289
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1290
+
1291
+ **Example**
1292
+
1293
+ ```handlebars
1294
+ {{#or a b c}}
1295
+ If any value is true this will be rendered.
1296
+ {{/or}}
1297
+ ```
1298
+
1299
+ ### [{{unlessEq}}](lib/comparison.js#L518)
1300
+
1301
+ Block helper that always renders the inverse block **unless `a` is
1302
+ is equal to `b`**.
1303
+
1304
+ **Params**
1305
+
1306
+ * `a` **{String}**
1307
+ * `b` **{String}**
1308
+ * `options` **{Object}**: Handlebars provided options object
1309
+ * `returns` **{String}**: Inverse block by default, or block if falsey.
1310
+
1311
+ ### [{{unlessGt}}](lib/comparison.js#L538)
1312
+
1313
+ Block helper that always renders the inverse block **unless `a` is
1314
+ is greater than `b`**.
1315
+
1316
+ **Params**
1317
+
1318
+ * `a` **{Object}**: The default value
1319
+ * `b` **{Object}**: The value to compare
1320
+ * `options` **{Object}**: Handlebars provided options object
1321
+ * `returns` **{String}**: Inverse block by default, or block if falsey.
1322
+
1323
+ ### [{{unlessLt}}](lib/comparison.js#L558)
1324
+
1325
+ Block helper that always renders the inverse block **unless `a` is
1326
+ is less than `b`**.
1327
+
1328
+ **Params**
1329
+
1330
+ * `a` **{Object}**: The default value
1331
+ * `b` **{Object}**: The value to compare
1332
+ * `options` **{Object}**: Handlebars provided options object
1333
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1334
+
1335
+ ### [{{unlessGteq}}](lib/comparison.js#L578)
1336
+
1337
+ Block helper that always renders the inverse block **unless `a` is
1338
+ is greater than or equal to `b`**.
1339
+
1340
+ **Params**
1341
+
1342
+ * `a` **{any}**
1343
+ * `b` **{any}**
1344
+ * `options` **{Object}**: Handlebars provided options object
1345
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1346
+
1347
+ ### [{{unlessLteq}}](lib/comparison.js#L598)
1348
+
1349
+ Block helper that always renders the inverse block **unless `a` is
1350
+ is less than or equal to `b`**.
1351
+
1352
+ **Params**
1353
+
1354
+ * `a` **{any}**
1355
+ * `b` **{any}**
1356
+ * `options` **{Object}**: Handlebars provided options object
1357
+ * `returns` **{String}**: Block, or inverse block if specified and falsey.
1358
+
1359
+ ## date
1360
+
1361
+ ### [{{year}}](lib/date.js#L15)
1362
+
1363
+ Get the current year.
1364
+
1365
+ **Example**
1366
+
1367
+ ```handlebars
1368
+ {{year}}
1369
+ <!-- 2017 -->
1370
+ ```
1371
+
1372
+ ### [{{moment}}](lib/date.js#L24)
1373
+
1374
+ Use [moment](http://momentjs.com) as a helper. See [helper-date](https://github.com/jonathas/helper-date) for more details.
1375
+
1376
+ ## fs
1377
+
1378
+ ### [{{read}}](lib/fs.js#L29)
1379
+
1380
+ Read a file from the file system. This is useful in composing "include"-style helpers using sub-expressions.
1381
+
1382
+ **Params**
1383
+
1384
+ * `filepath` **{String}**
1385
+ * `returns` **{String}**
1386
+
1387
+ **Example**
1388
+
1389
+ ```handlebars
1390
+ {{read "a/b/c.js"}}
1391
+ {{someHelper (read "a/b/c.md")}}
1392
+ ```
1393
+
1394
+ ### [{{readdir}}](lib/fs.js#L42)
1395
+
1396
+ Return an array of files from the given
1397
+ directory.
1398
+
1399
+ **Params**
1400
+
1401
+ * `directory` **{String}**
1402
+ * `returns` **{Array}**
1403
+
1404
+ ## html
1405
+
1406
+ ### [{{attr}}](lib/html.js#L23)
1407
+
1408
+ Stringify attributes on the options `hash`.
1409
+
1410
+ **Params**
1411
+
1412
+ * `options` **{Object}**
1413
+ * `returns` **{String}**
1414
+
1415
+ **Example**
1416
+
1417
+ ```handlebars
1418
+ <!-- value = 'bar' -->
1419
+ <div{{attr foo=value}}></div>
1420
+ <!-- results in: <div foo="bar"></div>
1421
+ ```
1422
+
1423
+ ### [{{css}}](lib/html.js#L45)
1424
+
1425
+ Add an array of `<link>` tags. Automatically resolves relative paths to `options.assets` if passed on the context.
1426
+
1427
+ **Params**
1428
+
1429
+ * `list` **{String|Array}**: One or more stylesheet urls.
1430
+ * `returns` **{String}**
1431
+
1432
+ **Example**
1433
+
1434
+ ```handlebars
1435
+ <!-- {stylesheets: ['foo.css', 'bar.css']} -->
1436
+ {{css stylesheets}}
1437
+
1438
+ <!-- results in: -->
1439
+ <!-- <link type="text/css" rel="stylesheet" href="foo.css"> -->
1440
+ <!-- <link type="text/css" rel="stylesheet" href="bar.css"> -->
1441
+ ```
1442
+
1443
+ ### [{{js}}](lib/html.js#L89)
1444
+
1445
+ Generate one or more `<script></script>` tags with paths/urls to javascript or coffeescript files.
1446
+
1447
+ **Params**
1448
+
1449
+ * `context` **{Object}**
1450
+ * `returns` **{String}**
1451
+
1452
+ **Example**
1453
+
1454
+ ```handlebars
1455
+ {{js scripts}}
1456
+ ```
1457
+
1458
+ ### [{{sanitize}}](lib/html.js#L121)
1459
+
1460
+ Strip HTML tags from a string, so that only the text nodes are preserved.
1461
+
1462
+ **Params**
1463
+
1464
+ * `str` **{String}**: The string of HTML to sanitize.
1465
+ * `returns` **{String}**
1466
+
1467
+ **Example**
1468
+
1469
+ ```handlebars
1470
+ {{sanitize "<span>foo</span>"}}
1471
+ <!-- results in: 'foo' -->
1472
+ ```
1473
+
1474
+ ### [{{ul}}](lib/html.js#L135)
1475
+
1476
+ Block helper for creating unordered lists (`<ul></ul>`)
1477
+
1478
+ **Params**
1479
+
1480
+ * `context` **{Object}**
1481
+ * `options` **{Object}**
1482
+ * `returns` **{String}**
1483
+
1484
+ ### [{{ol}}](lib/html.js#L154)
1485
+
1486
+ Block helper for creating ordered lists (`<ol></ol>`)
1487
+
1488
+ **Params**
1489
+
1490
+ * `context` **{Object}**
1491
+ * `options` **{Object}**
1492
+ * `returns` **{String}**
1493
+
1494
+ ### [{{thumbnailImage}}](lib/html.js#L176)
1495
+
1496
+ Returns a `<figure>` with a thumbnail linked to a full picture
1497
+
1498
+ **Params**
1499
+
1500
+ * `context` **{Object}**: Object with values/attributes to add to the generated elements:
1501
+ * `context.alt` **{String}**
1502
+ * `context.src` **{String}**
1503
+ * `context.width` **{Number}**
1504
+ * `context.height` **{Number}**
1505
+ * `returns` **{String}**: HTML `<figure>` element with image and optional caption/link.
1506
+
1507
+ ## i18n
1508
+
1509
+ ### [{{i18n}}](lib/i18n.js#L18)
1510
+
1511
+ i18n helper. See [button-i18n](https://github.com/assemble/buttons)
1512
+ for a working example.
1513
+
1514
+ **Params**
1515
+
1516
+ * `key` **{String}**
1517
+ * `options` **{Object}**
1518
+ * `returns` **{String}**
1519
+
1520
+ ## inflection
1521
+
1522
+ ### [{{inflect}}](lib/inflection.js#L30)
1523
+
1524
+ Returns either the `singular` or `plural` inflection of a word based on the given `count`.
1525
+
1526
+ **Params**
1527
+
1528
+ * `count` **{Number}**
1529
+ * `singular` **{String}**: The singular form
1530
+ * `plural` **{String}**: The plural form
1531
+ * `includeCount` **{String}**
1532
+ * `returns` **{String}**
1533
+
1534
+ **Example**
1535
+
1536
+ ```handlebars
1537
+ {{inflect 0 "string" "strings"}}
1538
+ <!-- "strings" -->
1539
+ {{inflect 1 "string" "strings"}}
1540
+ <!-- "string" -->
1541
+ {{inflect 1 "string" "strings" true}}
1542
+ <!-- "1 string" -->
1543
+ {{inflect 2 "string" "strings"}}
1544
+ <!-- "strings" -->
1545
+ {{inflect 2 "string" "strings" true}}
1546
+ <!-- "2 strings" -->
1547
+ ```
1548
+
1549
+ ### [{{ordinalize}}](lib/inflection.js#L58)
1550
+
1551
+ Returns an ordinalized number as a string.
1552
+
1553
+ **Params**
1554
+
1555
+ * `val` **{String}**: The value to ordinalize.
1556
+ * `returns` **{String}**: The ordinalized number
1557
+
1558
+ **Example**
1559
+
1560
+ ```handlebars
1561
+ {{ordinalize 1}}
1562
+ <!-- '1st' -->
1563
+ {{ordinalize 21}}
1564
+ <!-- '21st' -->
1565
+ {{ordinalize 29}}
1566
+ <!-- '29th' -->
1567
+ {{ordinalize 22}}
1568
+ <!-- '22nd' -->
1569
+ ```
1570
+
1571
+ ## logging
1572
+
1573
+ [logging-helpers](https://github.com/jonathas/logging-helpers).
1574
+
1575
+ ## markdown
1576
+
1577
+ ### [{{markdown}}](lib/markdown.js#L28)
1578
+
1579
+ Block helper that converts a string of inline markdown to HTML.
1580
+
1581
+ **Params**
1582
+
1583
+ * `context` **{Object}**
1584
+ * `options` **{Object}**
1585
+ * `returns` **{String}**
1586
+
1587
+ **Example**
1588
+
1589
+ ```handlebars
1590
+ {{#markdown}}
1591
+ # Foo
1592
+ {{/markdown}}
1593
+ <!-- results in: <h1>Foo</h1> -->
1594
+ ```
1595
+
1596
+ ### [{{md}}](lib/markdown.js#L55)
1597
+
1598
+ Read a markdown file from the file system and inject its contents after converting it to HTML.
1599
+
1600
+ **Params**
1601
+
1602
+ * `context` **{Object}**
1603
+ * `options` **{Object}**
1604
+ * `returns` **{String}**
1605
+
1606
+ **Example**
1607
+
1608
+ ```handlebars
1609
+ {{md "foo/bar.md"}}
1610
+ ```
1611
+
1612
+ ## match
1613
+
1614
+ ### [{{match}}](lib/match.js#L23)
1615
+
1616
+ Returns an array of strings that match the given glob pattern(s). Options may be passed on the options hash or locals.
1617
+
1618
+ **Params**
1619
+
1620
+ * `files` **{Array|String}**
1621
+ * `patterns` **{Array|String}**: One or more glob patterns.
1622
+ * `locals` **{Object}**
1623
+ * `options` **{Object}**
1624
+ * `returns` **{Array}**: Array of matches
1625
+
1626
+ **Example**
1627
+
1628
+ ```handlebars
1629
+ {{match (readdir "foo") "*.js"}}
1630
+ {{match (readdir "foo") (toRegex "\\.js$")}}
1631
+ ```
1632
+
1633
+ ### [{{isMatch}}](lib/match.js#L47)
1634
+
1635
+ Returns true if a filepath contains the given pattern. Options may be passed on the options hash or locals.
1636
+
1637
+ **Params**
1638
+
1639
+ * `filepath` **{String}**
1640
+ * `pattern` **{String}**
1641
+ * `options` **{Object}**
1642
+ * `returns` **{Boolean}**
1643
+
1644
+ **Example**
1645
+
1646
+ ```handlebars
1647
+ {{isMatch "foo.md" "*.md"}}
1648
+ <!-- results in: true -->
1649
+ ```
1650
+
1651
+ ## math
1652
+
1653
+ ### [{{abs}}](lib/math.js#L15)
1654
+
1655
+ Return the magnitude of `a`.
1656
+
1657
+ **Params**
1658
+
1659
+ * `a` **{Number}**
1660
+ * `returns` **{Number}**
1661
+
1662
+ ### [{{add}}](lib/math.js#L31)
1663
+
1664
+ Return the sum of `a` plus `b`.
1665
+
1666
+ **Params**
1667
+
1668
+ * `a` **{Number}**
1669
+ * `b` **{Number}**
1670
+ * `returns` **{Number}**
1671
+
1672
+ ### [{{avg}}](lib/math.js#L54)
1673
+
1674
+ Returns the average of all numbers in the given array.
1675
+
1676
+ **Params**
1677
+
1678
+ * `array` **{Array}**: Array of numbers to add up.
1679
+ * `returns` **{Number}**
1680
+
1681
+ **Example**
1682
+
1683
+ ```handlebars
1684
+ {{avg "[1, 2, 3, 4, 5]"}}
1685
+ <!-- results in: '3' -->
1686
+ ```
1687
+
1688
+ ### [{{ceil}}](lib/math.js#L69)
1689
+
1690
+ Get the `Math.ceil()` of the given value.
1691
+
1692
+ **Params**
1693
+
1694
+ * `value` **{Number}**
1695
+ * `returns` **{Number}**
1696
+
1697
+ ### [{{divide}}](lib/math.js#L84)
1698
+
1699
+ Divide `a` by `b`
1700
+
1701
+ **Params**
1702
+
1703
+ * `a` **{Number}**: numerator
1704
+ * `b` **{Number}**: denominator
1705
+
1706
+ ### [{{floor}}](lib/math.js#L102)
1707
+
1708
+ Get the `Math.floor()` of the given value.
1709
+
1710
+ **Params**
1711
+
1712
+ * `value` **{Number}**
1713
+ * `returns` **{Number}**
1714
+
1715
+ ### [{{minus}}](lib/math.js#L118)
1716
+
1717
+ Return the difference of `a` minus `b`.
1718
+
1719
+ **Params**
1720
+
1721
+ * `a` **{Number}**
1722
+ * `b` **{Number}**
1723
+
1724
+ ### [{{modulo}}](lib/math.js#L137)
1725
+
1726
+ Get the remainder of a division operation.
1727
+
1728
+ **Params**
1729
+
1730
+ * `a` **{Number}**
1731
+ * `b` **{Number}**
1732
+ * `returns` **{Number}**
1733
+
1734
+ ### [{{multiply}}](lib/math.js#L157)
1735
+
1736
+ Return the product of `a` times `b`.
1737
+
1738
+ **Params**
1739
+
1740
+ * `a` **{Number}**: factor
1741
+ * `b` **{Number}**: multiplier
1742
+ * `returns` **{Number}**
1743
+
1744
+ ### [{{plus}}](lib/math.js#L175)
1745
+
1746
+ Add `a` by `b`.
1747
+
1748
+ **Params**
1749
+
1750
+ * `a` **{Number}**: factor
1751
+ * `b` **{Number}**: multiplier
1752
+
1753
+ ### [{{random}}](lib/math.js#L194)
1754
+
1755
+ Generate a random number between two values
1756
+
1757
+ **Params**
1758
+
1759
+ * `min` **{Number}**
1760
+ * `max` **{Number}**
1761
+ * `returns` **{String}**
1762
+
1763
+ ### [{{remainder}}](lib/math.js#L212)
1764
+
1765
+ Get the remainder when `a` is divided by `b`.
1766
+
1767
+ **Params**
1768
+
1769
+ * `a` **{Number}**: a
1770
+ * `b` **{Number}**: b
1771
+
1772
+ ### [{{round}}](lib/math.js#L224)
1773
+
1774
+ Round the given number.
1775
+
1776
+ **Params**
1777
+
1778
+ * `number` **{Number}**
1779
+ * `returns` **{Number}**
1780
+
1781
+ ### [{{subtract}}](lib/math.js#L241)
1782
+
1783
+ Return the product of `a` minus `b`.
1784
+
1785
+ **Params**
1786
+
1787
+ * `a` **{Number}**
1788
+ * `b` **{Number}**
1789
+ * `returns` **{Number}**
1790
+
1791
+ ### [{{sum}}](lib/math.js#L263)
1792
+
1793
+ Returns the sum of all numbers in the given array.
1794
+
1795
+ **Params**
1796
+
1797
+ * `array` **{Array}**: Array of numbers to add up.
1798
+ * `returns` **{Number}**
1799
+
1800
+ **Example**
1801
+
1802
+ ```handlebars
1803
+ {{sum "[1, 2, 3, 4, 5]"}}
1804
+ <!-- results in: '15' -->
1805
+ ```
1806
+
1807
+ ### [{{times}}](lib/math.js#L286)
1808
+
1809
+ Multiply number `a` by number `b`.
1810
+
1811
+ **Params**
1812
+
1813
+ * `a` **{Number}**: factor
1814
+ * `b` **{Number}**: multiplier
1815
+ * `returns` **{Number}**
1816
+
1817
+ ## misc
1818
+
1819
+ ### [{{option}}](lib/misc.js#L26)
1820
+
1821
+ Return the given value of `prop` from `this.options`.
1822
+
1823
+ **Params**
1824
+
1825
+ * `prop` **{String}**
1826
+ * `returns` **{any}**
1827
+
1828
+ **Example**
1829
+
1830
+ ```handlebars
1831
+ <!-- context = {options: {a: {b: {c: 'ddd'}}}} -->
1832
+ {{option "a.b.c"}}
1833
+ <!-- results => `ddd` -->
1834
+ ```
1835
+
1836
+ ### [{{noop}}](lib/misc.js#L39)
1837
+
1838
+ Block helper that renders the block without taking any arguments.
1839
+
1840
+ **Params**
1841
+
1842
+ * `options` **{Object}**
1843
+ * `returns` **{String}**
1844
+
1845
+ ### [{{typeOf}}](lib/misc.js#L59)
1846
+
1847
+ Get the native type of the given `value`
1848
+
1849
+ **Params**
1850
+
1851
+ * `value` **{any}**
1852
+ * `returns` **{String}**: Returns the type of value.
1853
+
1854
+ **Example**
1855
+
1856
+ ```handlebars
1857
+ {{typeOf 1}}
1858
+ //=> 'number'
1859
+ {{typeOf "1"}}
1860
+ //=> 'string'
1861
+ {{typeOf "foo"}}
1862
+ //=> 'string'
1863
+ ```
1864
+
1865
+ ### [{{withHash}}](lib/misc.js#L71)
1866
+
1867
+ Block helper that builds the context for the block
1868
+ from the options hash.
1869
+
1870
+ **Params**
1871
+
1872
+ * `options` **{Object}**: Handlebars provided options object.
1873
+
1874
+ ## number
1875
+
1876
+ ### [{{bytes}}](lib/number.js#L24)
1877
+
1878
+ Format a number to it's equivalent in bytes. If a string is passed, it's length will be formatted and returned.
1879
+
1880
+ **Examples:**
1881
+
1882
+ * `'foo' => 3 B`
1883
+ * `13661855 => 13.66 MB`
1884
+ * `825399 => 825.39 kB`
1885
+ * `1396 => 1.4 kB`
1886
+
1887
+ **Params**
1888
+
1889
+ * `number` **{Number|String}**
1890
+ * `returns` **{String}**
1891
+
1892
+ ### [{{addCommas}}](lib/number.js#L61)
1893
+
1894
+ Add commas to numbers
1895
+
1896
+ **Params**
1897
+
1898
+ * `num` **{Number}**
1899
+ * `returns` **{Number}**
1900
+
1901
+ ### [{{phoneNumber}}](lib/number.js#L74)
1902
+
1903
+ Convert a string or number to a formatted phone number.
1904
+
1905
+ **Params**
1906
+
1907
+ * `num` **{Number|String}**: The phone number to format, e.g. `8005551212`
1908
+ * `returns` **{Number}**: Formatted phone number: `(800) 555-1212`
1909
+
1910
+ ### [{{toAbbr}}](lib/number.js#L92)
1911
+
1912
+ Abbreviate numbers to the given number of `precision`. This is for
1913
+ general numbers, not size in bytes.
1914
+
1915
+ **Params**
1916
+
1917
+ * `number` **{Number}**
1918
+ * `precision` **{Number}**
1919
+ * `returns` **{String}**
1920
+
1921
+ ### [{{toExponential}}](lib/number.js#L130)
1922
+
1923
+ Returns a string representing the given number in exponential notation.
1924
+
1925
+ **Params**
1926
+
1927
+ * `number` **{Number}**
1928
+ * `fractionDigits` **{Number}**: Optional. An integer specifying the number of digits to use after the decimal point. Defaults to as many digits as necessary to specify the number.
1929
+ * `returns` **{Number}**
1930
+
1931
+ **Example**
1932
+
1933
+ ```handlebars
1934
+ {{toExponential number digits}};
1935
+ ```
1936
+
1937
+ ### [{{toFixed}}](lib/number.js#L153)
1938
+
1939
+ Formats the given number using fixed-point notation.
1940
+
1941
+ **Params**
1942
+
1943
+ * `number` **{Number}**
1944
+ * `digits` **{Number}**: (Optional) The number of digits to appear after the decimal point; this may be a value between 0 and 20. If this argument is omitted, it is treated as 0.
1945
+ * `returns` **{String}**: A string representing the given number using fixed-point notation.
1946
+
1947
+ **Example**
1948
+
1949
+ ```handlebars
1950
+ {{toFixed "1.1234" 2}}
1951
+ //=> '1.12'
1952
+ ```
1953
+
1954
+ ### [{{toFloat}}](lib/number.js#L169)
1955
+
1956
+ **Params**
1957
+
1958
+ * `number` **{Number}**
1959
+ * `returns` **{Number}**
1960
+
1961
+ ### [{{toInt}}](lib/number.js#L179)
1962
+
1963
+ **Params**
1964
+
1965
+ * `number` **{Number}**
1966
+ * `returns` **{Number}**
1967
+
1968
+ ### [{{toPrecision}}](lib/number.js#L196)
1969
+
1970
+ Returns a string representing the `Number` object to the specified precision.
1971
+
1972
+ **Params**
1973
+
1974
+ * `number` **{Number}**
1975
+ * `precision` **{Number}**: (Optional) An integer specifying the number of significant digits. If precison is not between 1 and 100 (inclusive), it will be coerced to `0`.
1976
+ * `returns` **{String}**: A string representing a Number object in fixed-point or exponential notation rounded to precision significant digits.
1977
+
1978
+ **Example**
1979
+
1980
+ ```handlebars
1981
+ {{toPrecision "1.1234" 2}}
1982
+ //=> '1.1'
1983
+ ```
1984
+
1985
+ ## object
1986
+
1987
+ ### [{{extend}}](lib/object.js#L18)
1988
+
1989
+ Extend the context with the properties of other objects.
1990
+ A shallow merge is performed to avoid mutating the context.
1991
+
1992
+ **Params**
1993
+
1994
+ * `objects` **{Object}**: One or more objects to extend.
1995
+ * `returns` **{Object}**
1996
+
1997
+ ### [{{forIn}}](lib/object.js#L55)
1998
+
1999
+ Block helper that iterates over the properties of
2000
+ an object, exposing each key and value on the context.
2001
+
2002
+ **Params**
2003
+
2004
+ * `context` **{Object}**
2005
+ * `options` **{Object}**
2006
+ * `returns` **{String}**
2007
+
2008
+ ### [{{forOwn}}](lib/object.js#L81)
2009
+
2010
+ Block helper that iterates over the **own** properties of
2011
+ an object, exposing each key and value on the context.
2012
+
2013
+ **Params**
2014
+
2015
+ * `obj` **{Object}**: The object to iterate over.
2016
+ * `options` **{Object}**
2017
+ * `returns` **{String}**
2018
+
2019
+ ### [{{toPath}}](lib/object.js#L106)
2020
+
2021
+ Take arguments and, if they are string or number, convert them to a dot-delineated object property path.
2022
+
2023
+ **Params**
2024
+
2025
+ * `prop` **{String|Number}**: The property segments to assemble (can be multiple).
2026
+ * `returns` **{String}**
2027
+
2028
+ ### [{{get}}](lib/object.js#L128)
2029
+
2030
+ Use property paths (`a.b.c`) to get a value or nested value from
2031
+ the context. Works as a regular helper or block helper.
2032
+
2033
+ **Params**
2034
+
2035
+ * `prop` **{String}**: The property to get, optionally using dot notation for nested properties.
2036
+ * `context` **{Object}**: The context object
2037
+ * `options` **{Object}**: The handlebars options object, if used as a block helper.
2038
+ * `returns` **{String}**
2039
+
2040
+ ### [{{getObject}}](lib/object.js#L149)
2041
+
2042
+ Use property paths (`a.b.c`) to get an object from
2043
+ the context. Differs from the `get` helper in that this
2044
+ helper will return the actual object, including the
2045
+ given property key. Also, this helper does not work as a
2046
+ block helper.
2047
+
2048
+ **Params**
2049
+
2050
+ * `prop` **{String}**: The property to get, optionally using dot notation for nested properties.
2051
+ * `context` **{Object}**: The context object
2052
+ * `returns` **{String}**
2053
+
2054
+ ### [{{hasOwn}}](lib/object.js#L167)
2055
+
2056
+ Return true if `key` is an own, enumerable property of the given `context` object.
2057
+
2058
+ **Params**
2059
+
2060
+ * `key` **{String}**
2061
+ * `context` **{Object}**: The context object.
2062
+ * `returns` **{Boolean}**
2063
+
2064
+ **Example**
2065
+
2066
+ ```handlebars
2067
+ {{hasOwn context key}}
2068
+ ```
2069
+
2070
+ ### [{{isObject}}](lib/object.js#L183)
2071
+
2072
+ Return true if `value` is an object.
2073
+
2074
+ **Params**
2075
+
2076
+ * `value` **{String}**
2077
+ * `returns` **{Boolean}**
2078
+
2079
+ **Example**
2080
+
2081
+ ```handlebars
2082
+ {{isObject "foo"}}
2083
+ //=> false
2084
+ ```
2085
+
2086
+ ### [{{JSONparse}}](lib/object.js#L201)
2087
+
2088
+ Parses the given string using `JSON.parse`.
2089
+
2090
+ **Params**
2091
+
2092
+ * `string` **{String}**: The string to parse
2093
+
2094
+ **Example**
2095
+
2096
+ ```handlebars
2097
+ <!-- string: '{"foo": "bar"}' -->
2098
+ {{JSONparse string}}
2099
+ <!-- results in: { foo: 'bar' } -->
2100
+ ```
2101
+
2102
+ ### [{{JSONstringify}}](lib/object.js#L218)
2103
+
2104
+ Stringify an object using `JSON.stringify`.
2105
+
2106
+ **Params**
2107
+
2108
+ * `obj` **{Object}**: Object to stringify
2109
+ * `returns` **{String}**
2110
+
2111
+ **Example**
2112
+
2113
+ ```handlebars
2114
+ <!-- object: { foo: 'bar' } -->
2115
+ {{JSONstringify object}}
2116
+ <!-- results in: '{"foo": "bar"}' -->
2117
+ ```
2118
+
2119
+ ### [{{merge}}](lib/object.js#L235)
2120
+
2121
+ Deeply merge the properties of the given `objects` with the
2122
+ context object.
2123
+
2124
+ **Params**
2125
+
2126
+ * `object` **{Object}**: The target object. Pass an empty object to shallow clone.
2127
+ * `objects` **{Object}**
2128
+ * `returns` **{Object}**
2129
+
2130
+ ### [{{pick}}](lib/object.js#L267)
2131
+
2132
+ Pick properties from the context object.
2133
+
2134
+ **Params**
2135
+
2136
+ * `properties` **{Array|String}**: One or more properties to pick.
2137
+ * `context` **{Object}**
2138
+ * `options` **{Object}**: Handlebars options object.
2139
+ * `returns` **{Object}**: Returns an object with the picked values. If used as a block helper, the values are passed as context to the inner block. If no values are found, the context is passed to the inverse block.
2140
+
2141
+ ## path
2142
+
2143
+ ### [{{absolute}}](lib/path.js#L20)
2144
+
2145
+ Get the directory path segment from the given `filepath`.
2146
+
2147
+ **Params**
2148
+
2149
+ * `ext` **{String}**
2150
+ * `returns` **{String}**
2151
+
2152
+ **Example**
2153
+
2154
+ ```handlebars
2155
+ {{absolute "docs/toc.md"}}
2156
+ <!-- results in: 'docs' -->
2157
+ ```
2158
+
2159
+ ### [{{dirname}}](lib/path.js#L40)
2160
+
2161
+ Get the directory path segment from the given `filepath`.
2162
+
2163
+ **Params**
2164
+
2165
+ * `ext` **{String}**
2166
+ * `returns` **{String}**
2167
+
2168
+ **Example**
2169
+
2170
+ ```handlebars
2171
+ {{dirname "docs/toc.md"}}
2172
+ <!-- results in: 'docs' -->
2173
+ ```
2174
+
2175
+ ### [{{relative}}](lib/path.js#L59)
2176
+
2177
+ Get the relative filepath from `a` to `b`.
2178
+
2179
+ **Params**
2180
+
2181
+ * `a` **{String}**
2182
+ * `b` **{String}**
2183
+ * `returns` **{String}**
2184
+
2185
+ **Example**
2186
+
2187
+ ```handlebars
2188
+ {{relative a b}}
2189
+ ```
2190
+
2191
+ ### [{{basename}}](lib/path.js#L81)
2192
+
2193
+ Get the file extension from the given `filepath`.
2194
+
2195
+ **Params**
2196
+
2197
+ * `ext` **{String}**
2198
+ * `returns` **{String}**
2199
+
2200
+ **Example**
2201
+
2202
+ ```handlebars
2203
+ {{basename "docs/toc.md"}}
2204
+ <!-- results in: 'toc.md' -->
2205
+ ```
2206
+
2207
+ ### [{{stem}}](lib/path.js#L100)
2208
+
2209
+ Get the "stem" from the given `filepath`.
2210
+
2211
+ **Params**
2212
+
2213
+ * `filepath` **{String}**
2214
+ * `returns` **{String}**
2215
+
2216
+ **Example**
2217
+
2218
+ ```handlebars
2219
+ {{stem "docs/toc.md"}}
2220
+ <!-- results in: 'toc' -->
2221
+ ```
2222
+
2223
+ ### [{{extname}}](lib/path.js#L119)
2224
+
2225
+ Get the file extension from the given `filepath`.
2226
+
2227
+ **Params**
2228
+
2229
+ * `filepath` **{String}**
2230
+ * `returns` **{String}**
2231
+
2232
+ **Example**
2233
+
2234
+ ```handlebars
2235
+ {{extname "docs/toc.md"}}
2236
+ <!-- results in: '.md' -->
2237
+ ```
2238
+
2239
+ ### [{{resolve}}](lib/path.js#L138)
2240
+
2241
+ Resolve an absolute path from the given `filepath`.
2242
+
2243
+ **Params**
2244
+
2245
+ * `filepath` **{String}**
2246
+ * `returns` **{String}**
2247
+
2248
+ **Example**
2249
+
2250
+ ```handlebars
2251
+ {{resolve "docs/toc.md"}}
2252
+ <!-- results in: '/User/dev/docs/toc.md' -->
2253
+ ```
2254
+
2255
+ ### [{{segments}}](lib/path.js#L166)
2256
+
2257
+ Get specific (joined) segments of a file path by passing a range of array indices.
2258
+
2259
+ **Params**
2260
+
2261
+ * `filepath` **{String}**: The file path to split into segments.
2262
+ * `returns` **{String}**: Returns a single, joined file path.
2263
+
2264
+ **Example**
2265
+
2266
+ ```handlebars
2267
+ {{segments "a/b/c/d" "2" "3"}}
2268
+ <!-- results in: 'c/d' -->
2269
+
2270
+ {{segments "a/b/c/d" "1" "3"}}
2271
+ <!-- results in: 'b/c/d' -->
2272
+
2273
+ {{segments "a/b/c/d" "1" "2"}}
2274
+ <!-- results in: 'b/c' -->
2275
+ ```
2276
+
2277
+ ## regex
2278
+
2279
+ ### [{{toRegex}}](lib/regex.js#L19)
2280
+
2281
+ Convert the given string to a regular expression.
2282
+
2283
+ **Params**
2284
+
2285
+ * `str` **{String}**
2286
+ * `returns` **{RegExp}**
2287
+
2288
+ **Example**
2289
+
2290
+ ```handlebars
2291
+ {{toRegex "foo"}}
2292
+ <!-- results in: /foo/ -->
2293
+ ```
2294
+
2295
+ ### [{{test}}](lib/regex.js#L42)
2296
+
2297
+ Returns true if the given `str` matches the given regex. A regex can be passed on the context, or using the [toRegex](#toregex) helper as a subexpression.
2298
+
2299
+ **Params**
2300
+
2301
+ * `str` **{String}**
2302
+ * `returns` **{RegExp}**
2303
+
2304
+ **Example**
2305
+
2306
+ ```handlebars
2307
+ {{test "bar" (toRegex "foo")}}
2308
+ <!-- results in: false -->
2309
+ {{test "foobar" (toRegex "foo")}}
2310
+ <!-- results in: true -->
2311
+ {{test "foobar" (toRegex "^foo$")}}
2312
+ <!-- results in: false -->
2313
+ ```
2314
+
2315
+ ## string
2316
+
2317
+ ### [{{append}}](lib/string.js#L22)
2318
+
2319
+ Append the specified `suffix` to the given string.
2320
+
2321
+ **Params**
2322
+
2323
+ * `str` **{String}**
2324
+ * `suffix` **{String}**
2325
+ * `returns` **{String}**
2326
+
2327
+ **Example**
2328
+
2329
+ ```handlebars
2330
+ <!-- given that "item.stem" is "foo" -->
2331
+ {{append item.stem ".html"}}
2332
+ <!-- results in: 'foo.html' -->
2333
+ ```
2334
+
2335
+ ### [{{camelcase}}](lib/string.js#L41)
2336
+
2337
+ camelCase the characters in the given `string`.
2338
+
2339
+ **Params**
2340
+
2341
+ * `string` **{String}**: The string to camelcase.
2342
+ * `returns` **{String}**
2343
+
2344
+ **Example**
2345
+
2346
+ ```handlebars
2347
+ {{camelcase "foo bar baz"}};
2348
+ <!-- results in: 'fooBarBaz' -->
2349
+ ```
2350
+
2351
+ ### [{{capitalize}}](lib/string.js#L60)
2352
+
2353
+ Capitalize the first word in a sentence.
2354
+
2355
+ **Params**
2356
+
2357
+ * `str` **{String}**
2358
+ * `returns` **{String}**
2359
+
2360
+ **Example**
2361
+
2362
+ ```handlebars
2363
+ {{capitalize "foo bar baz"}}
2364
+ <!-- results in: "Foo bar baz" -->
2365
+ ```
2366
+
2367
+ ### [{{capitalizeAll}}](lib/string.js#L77)
2368
+
2369
+ Capitalize all words in a string.
2370
+
2371
+ **Params**
2372
+
2373
+ * `str` **{String}**
2374
+ * `returns` **{String}**
2375
+
2376
+ **Example**
2377
+
2378
+ ```handlebars
2379
+ {{capitalizeAll "foo bar baz"}}
2380
+ <!-- results in: "Foo Bar Baz" -->
2381
+ ```
2382
+
2383
+ ### [{{center}}](lib/string.js#L95)
2384
+
2385
+ Center a string using non-breaking spaces
2386
+
2387
+ **Params**
2388
+
2389
+ * `str` **{String}**
2390
+ * `spaces` **{String}**
2391
+ * `returns` **{String}**
2392
+
2393
+ ### [{{chop}}](lib/string.js#L125)
2394
+
2395
+ Like trim, but removes both extraneous whitespace **and non-word characters** from the beginning and end of a string.
2396
+
2397
+ **Params**
2398
+
2399
+ * `string` **{String}**: The string to chop.
2400
+ * `returns` **{String}**
2401
+
2402
+ **Example**
2403
+
2404
+ ```handlebars
2405
+ {{chop "_ABC_"}}
2406
+ <!-- results in: 'ABC' -->
2407
+
2408
+ {{chop "-ABC-"}}
2409
+ <!-- results in: 'ABC' -->
2410
+
2411
+ {{chop " ABC "}}
2412
+ <!-- results in: 'ABC' -->
2413
+ ```
2414
+
2415
+ ### [{{dashcase}}](lib/string.js#L143)
2416
+
2417
+ dash-case the characters in `string`. Replaces non-word characters and periods with hyphens.
2418
+
2419
+ **Params**
2420
+
2421
+ * `string` **{String}**
2422
+ * `returns` **{String}**
2423
+
2424
+ **Example**
2425
+
2426
+ ```handlebars
2427
+ {{dashcase "a-b-c d_e"}}
2428
+ <!-- results in: 'a-b-c-d-e' -->
2429
+ ```
2430
+
2431
+ ### [{{dotcase}}](lib/string.js#L162)
2432
+
2433
+ dot.case the characters in `string`.
2434
+
2435
+ **Params**
2436
+
2437
+ * `string` **{String}**
2438
+ * `returns` **{String}**
2439
+
2440
+ **Example**
2441
+
2442
+ ```handlebars
2443
+ {{dotcase "a-b-c d_e"}}
2444
+ <!-- results in: 'a.b.c.d.e' -->
2445
+ ```
2446
+
2447
+ ### [{{downcase}}](lib/string.js#L182)
2448
+
2449
+ Lowercase all of the characters in the given string. Alias for [lowercase](#lowercase).
2450
+
2451
+ **Params**
2452
+
2453
+ * `string` **{String}**
2454
+ * `returns` **{String}**
2455
+
2456
+ **Example**
2457
+
2458
+ ```handlebars
2459
+ {{downcase "aBcDeF"}}
2460
+ <!-- results in: 'abcdef' -->
2461
+ ```
2462
+
2463
+ ### [{{ellipsis}}](lib/string.js#L202)
2464
+
2465
+ Truncates a string to the specified `length`, and appends it with an elipsis, `…`.
2466
+
2467
+ **Params**
2468
+
2469
+ * `str` **{String}**
2470
+ * `length` **{Number}**: The desired length of the returned string.
2471
+ * `returns` **{String}**: The truncated string.
2472
+
2473
+ **Example**
2474
+
2475
+ ```handlebars
2476
+ {{ellipsis (sanitize "<span>foo bar baz</span>"), 7}}
2477
+ <!-- results in: 'foo bar…' -->
2478
+ {{ellipsis "foo bar baz", 7}}
2479
+ <!-- results in: 'foo bar…' -->
2480
+ ```
2481
+
2482
+ ### [{{hyphenate}}](lib/string.js#L223)
2483
+
2484
+ Replace spaces in a string with hyphens.
2485
+
2486
+ **Params**
2487
+
2488
+ * `str` **{String}**
2489
+ * `returns` **{String}**
2490
+
2491
+ **Example**
2492
+
2493
+ ```handlebars
2494
+ {{hyphenate "foo bar baz qux"}}
2495
+ <!-- results in: "foo-bar-baz-qux" -->
2496
+ ```
2497
+
2498
+ ### [{{isString}}](lib/string.js#L240)
2499
+
2500
+ Return true if `value` is a string.
2501
+
2502
+ **Params**
2503
+
2504
+ * `value` **{String}**
2505
+ * `returns` **{Boolean}**
2506
+
2507
+ **Example**
2508
+
2509
+ ```handlebars
2510
+ {{isString "foo"}}
2511
+ <!-- results in: 'true' -->
2512
+ ```
2513
+
2514
+ ### [{{lowercase}}](lib/string.js#L256)
2515
+
2516
+ Lowercase all characters in the given string.
2517
+
2518
+ **Params**
2519
+
2520
+ * `str` **{String}**
2521
+ * `returns` **{String}**
2522
+
2523
+ **Example**
2524
+
2525
+ ```handlebars
2526
+ {{lowercase "Foo BAR baZ"}}
2527
+ <!-- results in: 'foo bar baz' -->
2528
+ ```
2529
+
2530
+ ### [{{occurrences}}](lib/string.js#L278)
2531
+
2532
+ Return the number of occurrences of `substring` within the given `string`.
2533
+
2534
+ **Params**
2535
+
2536
+ * `str` **{String}**
2537
+ * `substring` **{String}**
2538
+ * `returns` **{Number}**: Number of occurrences
2539
+
2540
+ **Example**
2541
+
2542
+ ```handlebars
2543
+ {{occurrences "foo bar foo bar baz" "foo"}}
2544
+ <!-- results in: 2 -->
2545
+ ```
2546
+
2547
+ ### [{{pascalcase}}](lib/string.js#L303)
2548
+
2549
+ PascalCase the characters in `string`.
2550
+
2551
+ **Params**
2552
+
2553
+ * `string` **{String}**
2554
+ * `returns` **{String}**
2555
+
2556
+ **Example**
2557
+
2558
+ ```handlebars
2559
+ {{pascalcase "foo bar baz"}}
2560
+ <!-- results in: 'FooBarBaz' -->
2561
+ ```
2562
+
2563
+ ### [{{pathcase}}](lib/string.js#L323)
2564
+
2565
+ path/case the characters in `string`.
2566
+
2567
+ **Params**
2568
+
2569
+ * `string` **{String}**
2570
+ * `returns` **{String}**
2571
+
2572
+ **Example**
2573
+
2574
+ ```handlebars
2575
+ {{pathcase "a-b-c d_e"}}
2576
+ <!-- results in: 'a/b/c/d/e' -->
2577
+ ```
2578
+
2579
+ ### [{{plusify}}](lib/string.js#L343)
2580
+
2581
+ Replace spaces in the given string with pluses.
2582
+
2583
+ **Params**
2584
+
2585
+ * `str` **{String}**: The input string
2586
+ * `returns` **{String}**: Input string with spaces replaced by plus signs
2587
+
2588
+ **Example**
2589
+
2590
+ ```handlebars
2591
+ {{plusify "foo bar baz"}}
2592
+ <!-- results in: 'foo+bar+baz' -->
2593
+ ```
2594
+
2595
+ ### [{{prepend}}](lib/string.js#L363)
2596
+
2597
+ Prepends the given `string` with the specified `prefix`.
2598
+
2599
+ **Params**
2600
+
2601
+ * `str` **{String}**
2602
+ * `prefix` **{String}**
2603
+ * `returns` **{String}**
2604
+
2605
+ **Example**
2606
+
2607
+ ```handlebars
2608
+ <!-- given that "val" is "bar" -->
2609
+ {{prepend val "foo-"}}
2610
+ <!-- results in: 'foo-bar' -->
2611
+ ```
2612
+
2613
+ ### [{{raw}}](lib/string.js#L385)
2614
+
2615
+ Render a block without processing mustache templates inside the block.
2616
+
2617
+ **Params**
2618
+
2619
+ * `options` **{Object}**
2620
+ * `returns` **{String}**
2621
+
2622
+ **Example**
2623
+
2624
+ ```handlebars
2625
+ {{{{#raw}}}}
2626
+ {{foo}}
2627
+ {{{{/raw}}}}
2628
+ <!-- results in: '{{foo}}' -->
2629
+ ```
2630
+
2631
+ ### [{{remove}}](lib/string.js#L413)
2632
+
2633
+ Remove all occurrences of `substring` from the given `str`.
2634
+
2635
+ **Params**
2636
+
2637
+ * `str` **{String}**
2638
+ * `substring` **{String}**
2639
+ * `returns` **{String}**
2640
+
2641
+ **Example**
2642
+
2643
+ ```handlebars
2644
+ {{remove "a b a b a b" "a "}}
2645
+ <!-- results in: 'b b b' -->
2646
+ ```
2647
+
2648
+ ### [{{removeFirst}}](lib/string.js#L432)
2649
+
2650
+ Remove the first occurrence of `substring` from the given `str`.
2651
+
2652
+ **Params**
2653
+
2654
+ * `str` **{String}**
2655
+ * `substring` **{String}**
2656
+ * `returns` **{String}**
2657
+
2658
+ **Example**
2659
+
2660
+ ```handlebars
2661
+ {{remove "a b a b a b" "a"}}
2662
+ <!-- results in: ' b a b a b' -->
2663
+ ```
2664
+
2665
+ ### [{{replace}}](lib/string.js#L452)
2666
+
2667
+ Replace all occurrences of substring `a` with substring `b`.
2668
+
2669
+ **Params**
2670
+
2671
+ * `str` **{String}**
2672
+ * `a` **{String}**
2673
+ * `b` **{String}**
2674
+ * `returns` **{String}**
2675
+
2676
+ **Example**
2677
+
2678
+ ```handlebars
2679
+ {{replace "a b a b a b" "a" "z"}}
2680
+ <!-- results in: 'z b z b z b' -->
2681
+ ```
2682
+
2683
+ ### [{{replaceFirst}}](lib/string.js#L473)
2684
+
2685
+ Replace the first occurrence of substring `a` with substring `b`.
2686
+
2687
+ **Params**
2688
+
2689
+ * `str` **{String}**
2690
+ * `a` **{String}**
2691
+ * `b` **{String}**
2692
+ * `returns` **{String}**
2693
+
2694
+ **Example**
2695
+
2696
+ ```handlebars
2697
+ {{replace "a b a b a b" "a" "z"}}
2698
+ <!-- results in: 'z b a b a b' -->
2699
+ ```
2700
+
2701
+ ### [{{reverse}}](lib/string.js#L492)
2702
+
2703
+ Reverse a string.
2704
+
2705
+ **Params**
2706
+
2707
+ * `str` **{String}**
2708
+ * `returns` **{String}**
2709
+
2710
+ **Example**
2711
+
2712
+ ```handlebars
2713
+ {{reverse "abcde"}}
2714
+ <!-- results in: 'edcba' -->
2715
+ ```
2716
+
2717
+ ### [{{sentence}}](lib/string.js#L509)
2718
+
2719
+ Sentence case the given string
2720
+
2721
+ **Params**
2722
+
2723
+ * `str` **{String}**
2724
+ * `returns` **{String}**
2725
+
2726
+ **Example**
2727
+
2728
+ ```handlebars
2729
+ {{sentence "hello world. goodbye world."}}
2730
+ <!-- results in: 'Hello world. Goodbye world.' -->
2731
+ ```
2732
+
2733
+ ### [{{snakecase}}](lib/string.js#L528)
2734
+
2735
+ snake_case the characters in the given `string`.
2736
+
2737
+ **Params**
2738
+
2739
+ * `string` **{String}**
2740
+ * `returns` **{String}**
2741
+
2742
+ **Example**
2743
+
2744
+ ```handlebars
2745
+ {{snakecase "a-b-c d_e"}}
2746
+ <!-- results in: 'a_b_c_d_e' -->
2747
+ ```
2748
+
2749
+ ### [{{split}}](lib/string.js#L547)
2750
+
2751
+ Split `string` by the given `character`.
2752
+
2753
+ **Params**
2754
+
2755
+ * `string` **{String}**: The string to split.
2756
+ * `returns` **{String}** `character`: Default is an empty string.
2757
+
2758
+ **Example**
2759
+
2760
+ ```handlebars
2761
+ {{split "a,b,c" ","}}
2762
+ <!-- results in: ['a', 'b', 'c'] -->
2763
+ ```
2764
+
2765
+ ### [{{startsWith}}](lib/string.js#L572)
2766
+
2767
+ Tests whether a string begins with the given prefix.
2768
+
2769
+ **Params**
2770
+
2771
+ * `prefix` **{String}**
2772
+ * `testString` **{String}**
2773
+ * `options` **{String}**
2774
+ * `returns` **{String}**
2775
+
2776
+ **Example**
2777
+
2778
+ ```handlebars
2779
+ {{#startsWith "Goodbye" "Hello, world!"}}
2780
+ Whoops
2781
+ {{else}}
2782
+ Bro, do you even hello world?
2783
+ {{/startsWith}}
2784
+ ```
2785
+
2786
+ ### [{{titleize}}](lib/string.js#L596)
2787
+
2788
+ Title case the given string.
2789
+
2790
+ **Params**
2791
+
2792
+ * `str` **{String}**
2793
+ * `returns` **{String}**
2794
+
2795
+ **Example**
2796
+
2797
+ ```handlebars
2798
+ {{titleize "this is title case"}}
2799
+ <!-- results in: 'This Is Title Case' -->
2800
+ ```
2801
+
2802
+ ### [{{trim}}](lib/string.js#L623)
2803
+
2804
+ Removes extraneous whitespace from the beginning and end of a string.
2805
+
2806
+ **Params**
2807
+
2808
+ * `string` **{String}**: The string to trim.
2809
+ * `returns` **{String}**
2810
+
2811
+ **Example**
2812
+
2813
+ ```handlebars
2814
+ {{trim " ABC "}}
2815
+ <!-- results in: 'ABC' -->
2816
+ ```
2817
+
2818
+ ### [{{trimLeft}}](lib/string.js#L639)
2819
+
2820
+ Removes extraneous whitespace from the beginning of a string.
2821
+
2822
+ **Params**
2823
+
2824
+ * `string` **{String}**: The string to trim.
2825
+ * `returns` **{String}**
2826
+
2827
+ **Example**
2828
+
2829
+ ```handlebars
2830
+ {{trim " ABC "}}
2831
+ <!-- results in: 'ABC ' -->
2832
+ ```
2833
+
2834
+ ### [{{trimRight}}](lib/string.js#L657)
2835
+
2836
+ Removes extraneous whitespace from the end of a string.
2837
+
2838
+ **Params**
2839
+
2840
+ * `string` **{String}**: The string to trim.
2841
+ * `returns` **{String}**
2842
+
2843
+ **Example**
2844
+
2845
+ ```handlebars
2846
+ {{trimRight " ABC "}}
2847
+ <!-- results in: ' ABC' -->
2848
+ ```
2849
+
2850
+ ### [{{truncate}}](lib/string.js#L680)
2851
+
2852
+ Truncate a string to the specified `length`. Also see [ellipsis](#ellipsis).
2853
+
2854
+ **Params**
2855
+
2856
+ * `str` **{String}**
2857
+ * `limit` **{Number}**: The desired length of the returned string.
2858
+ * `suffix` **{String}**: Optionally supply a string to use as a suffix to denote when the string has been truncated. Otherwise an ellipsis (`…`) will be used.
2859
+ * `returns` **{String}**: The truncated string.
2860
+
2861
+ **Example**
2862
+
2863
+ ```handlebars
2864
+ truncate("foo bar baz", 7);
2865
+ <!-- results in: 'foo bar' -->
2866
+ truncate(sanitize("<span>foo bar baz</span>", 7));
2867
+ <!-- results in: 'foo bar' -->
2868
+ ```
2869
+
2870
+ ### [{{truncateWords}}](lib/string.js#L712)
2871
+
2872
+ Truncate a string to have the specified number of words. Also see [truncate](#truncate).
2873
+
2874
+ **Params**
2875
+
2876
+ * `str` **{String}**
2877
+ * `limit` **{Number}**: The desired length of the returned string.
2878
+ * `suffix` **{String}**: Optionally supply a string to use as a suffix to denote when the string has been truncated.
2879
+ * `returns` **{String}**: The truncated string.
2880
+
2881
+ **Example**
2882
+
2883
+ ```handlebars
2884
+ truncateWords("foo bar baz", 1);
2885
+ <!-- results in: 'foo…' -->
2886
+ truncateWords("foo bar baz", 2);
2887
+ <!-- results in: 'foo bar…' -->
2888
+ truncateWords("foo bar baz", 3);
2889
+ <!-- results in: 'foo bar baz' -->
2890
+ ```
2891
+
2892
+ ### [{{upcase}}](lib/string.js#L742)
2893
+
2894
+ Uppercase all of the characters in the given string. Alias for [uppercase](#uppercase).
2895
+
2896
+ **Params**
2897
+
2898
+ * `string` **{String}**
2899
+ * `returns` **{String}**
2900
+
2901
+ **Example**
2902
+
2903
+ ```handlebars
2904
+ {{upcase "aBcDeF"}}
2905
+ <!-- results in: 'ABCDEF' -->
2906
+ ```
2907
+
2908
+ ### [{{uppercase}}](lib/string.js#L763)
2909
+
2910
+ Uppercase all of the characters in the given string. If used as a block helper it will uppercase the entire block. This helper does not support inverse blocks.
2911
+
2912
+ **Params**
2913
+
2914
+ * `str` **{String}**: The string to uppercase
2915
+ * `options` **{Object}**: Handlebars options object
2916
+ * `returns` **{String}**
2917
+
2918
+ **Example**
2919
+
2920
+ ```handlebars
2921
+ {{uppercase "aBcDeF"}}
2922
+ <!-- results in: 'ABCDEF' -->
2923
+ ```
2924
+
2925
+ ## url
2926
+
2927
+ ### [{{encodeURI}}](lib/url.js#L19)
2928
+
2929
+ Encodes a Uniform Resource Identifier (URI) component
2930
+ by replacing each instance of certain characters by
2931
+ one, two, three, or four escape sequences representing
2932
+ the UTF-8 encoding of the character.
2933
+
2934
+ **Params**
2935
+
2936
+ * `str` **{String}**: The un-encoded string
2937
+ * `returns` **{String}**: The endcoded string
2938
+
2939
+ ### [{{escape}}](lib/url.js#L34)
2940
+
2941
+ Escape the given string by replacing characters with escape sequences.
2942
+ Useful for allowing the string to be used in a URL, etc.
2943
+
2944
+ **Params**
2945
+
2946
+ * `str` **{String}**
2947
+ * `returns` **{String}**: Escaped string.
2948
+
2949
+ ### [{{decodeURI}}](lib/url.js#L48)
2950
+
2951
+ Decode a Uniform Resource Identifier (URI) component.
2952
+
2953
+ **Params**
2954
+
2955
+ * `str` **{String}**
2956
+ * `returns` **{String}**
2957
+
2958
+ ### [{{url_encode}}](lib/url.js#L59)
2959
+
2960
+ Alias for [encodeURI](#encodeuri).
2961
+
2962
+ ### [{{url_decode}}](lib/url.js#L68)
2963
+
2964
+ Alias for [decodeURI](#decodeuri).
2965
+
2966
+ ### [{{urlResolve}}](lib/url.js#L82)
2967
+
2968
+ Take a base URL, and a href URL, and resolve them as a
2969
+ browser would for an anchor tag.
2970
+
2971
+ **Params**
2972
+
2973
+ * `base` **{String}**
2974
+ * `href` **{String}**
2975
+ * `returns` **{String}**
2976
+
2977
+ ### [{{urlParse}}](lib/url.js#L94)
2978
+
2979
+ Parses a `url` string into an object.
2980
+
2981
+ **Params**
2982
+
2983
+ * `str` **{String}**: URL string
2984
+ * `returns` **{String}**: Returns stringified JSON
2985
+
2986
+ ### [{{stripQuerystring}}](lib/url.js#L106)
2987
+
2988
+ Strip the query string from the given `url`.
2989
+
2990
+ **Params**
2991
+
2992
+ * `url` **{String}**
2993
+ * `returns` **{String}**: the url without the queryString
2994
+
2995
+ ### [{{stripProtocol}}](lib/url.js#L126)
2996
+
2997
+ Strip protocol from a `url`. Useful for displaying media that may have an 'http' protocol on secure connections.
2998
+
2999
+ **Params**
3000
+
3001
+ * `str` **{String}**
3002
+ * `returns` **{String}**: the url with http protocol stripped
3003
+
3004
+ **Example**
3005
+
3006
+ ```handlebars
3007
+ <!-- url = 'http://foo.bar' -->
3008
+ {{stripProtocol url}}
3009
+ <!-- results in: '//foo.bar' -->
3010
+ ```
3011
+
3012
+ ***
3013
+
3014
+ ## Utils
3015
+
3016
+ The following utils are exposed on `.utils`.
3017
+
3018
+ ### [{{changecase}}](lib/utils/index.js#L54)
3019
+
3020
+ Change casing on the given `string`, optionally passing a delimiter to use between words in the returned string.
3021
+
3022
+ **Params**
3023
+
3024
+ * `string` **{String}**: The string to change.
3025
+ * `returns` **{String}**
3026
+
3027
+ **Example**
3028
+
3029
+ ```handlebars
3030
+ utils.changecase('fooBarBaz');
3031
+ //=> 'foo bar baz'
3032
+
3033
+ utils.changecase('fooBarBaz' '-');
3034
+ //=> 'foo-bar-baz'
3035
+ ```
3036
+
3037
+ ### [{{random}}](lib/utils/index.js#L80)
3038
+
3039
+ Generate a random number
3040
+
3041
+ **Params**
3042
+
3043
+ * `min` **{Number}**
3044
+ * `max` **{Number}**
3045
+ * `returns` **{Number}**
3046
+
3047
+ ***
3048
+
3049
+ ## How to Contribute
3050
+ Now that you've set up your workspace, you're ready to contribute changes to the `fumanchu` repository you can refer to the [CONTRIBUTING](CONTRIBUTING.md) guide. If you have any questions please feel free to ask by creating an issue and label it `question`.
3051
+
3052
+ ## License and Copyright
3053
+ [MIT](LICENSE) and codebase after 2023 will be copyright of Jared Wray.
3054
+
3055
+ This is a fork of [handlebars-helpers]() which is licensed under MIT. Initial copyright of handlebars-helpers: `2013-2015, 2017, Jon Schlinkert, Brian Woodward`. Thank you so much for your effort and building this! We have also continued to list all contributors in `package.json` to ensure that they are recognized.