handlebars-helpers
Version:
More than 130 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.
1,555 lines (1,085 loc) • 88.1 kB
Markdown
# handlebars-helpers [](https://www.npmjs.com/package/handlebars-helpers) [](https://npmjs.org/package/handlebars-helpers) [](https://npmjs.org/package/handlebars-helpers) [](https://travis-ci.org/helpers/handlebars-helpers) [](https://ci.appveyor.com/project/helpers/handlebars-helpers)
> More than 130 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.
You might also be interested in [template-helpers](https://github.com/jonschlinkert/template-helpers).
- [Install](#install)
- [Browser usage](#browser-usage)
- [Usage](#usage)
- [Helpers](#helpers)
- [Utils](#utils)
- [History](#history)
- [About](#about)
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save handlebars-helpers
```
Install with [yarn](https://yarnpkg.com):
```sh
$ yarn add handlebars-helpers
```
## Browser usage
See how to [use handlebars-helpers in the browser](https://github.com/doowb/handlebars-helpers-browserify-example).
## Usage
The main export returns a function that needs to be called to expose the object of helpers.
**Get all helpers**
```js
var helpers = require('handlebars-helpers')();
//=> returns object with all (130+) helpers
```
**Get a specific helper collection**
Helper collections are exposed as getters, so only the helpers you want will be required and loaded.
```js
var helpers = require('handlebars-helpers');
var math = helpers.math();
//=> only the `math` helpers
var helpers = require('handlebars-helpers');
var array = helpers.array();
//=> only the `collections` helpers
```
**Get multiple helpers collections**
Helper collections are exposed as getters, so only the helpers you want will be required and loaded.
```js
var helpers = require('handlebars-helpers')(['math', 'string']);
//=> only the `math` and `string` helpers
```
**Optionally pass your own handlebars**
```js
var handlebars = require('handlebars');
var helpers = require('handlebars-helpers')({
handlebars: handlebars
});
// or for a specific collection
var math = helpers.math({
handlebars: handlebars
});
```
## Helpers
## Categories
Currently **189 helpers** in **20 categories**:
* **[array](#array)** ([code](lib/array.js) | [unit tests](test/array.js))
* **[code](#code)** ([code](lib/code.js) | [unit tests](test/code.js))
* **[collection](#collection)** ([code](lib/collection.js) | [unit tests](test/collection.js))
* **[comparison](#comparison)** ([code](lib/comparison.js) | [unit tests](test/comparison.js))
* **[date](#date)** ([code](lib/date.js) | [unit tests](test/date.js))
* **[fs](#fs)** ([code](lib/fs.js) | [unit tests](test/fs.js))
* **[html](#html)** ([code](lib/html.js) | [unit tests](test/html.js))
* **[i18n](#i18n)** ([code](lib/i18n.js) | [unit tests](test/i18n.js))
* **[inflection](#inflection)** ([code](lib/inflection.js) | [unit tests](test/inflection.js))
* **[logging](#logging)** ([code](lib/logging.js) | [unit tests](test/logging.js))
* **[markdown](#markdown)** ([code](lib/markdown.js) | [unit tests](test/markdown.js))
* **[match](#match)** ([code](lib/match.js) | [unit tests](test/match.js))
* **[math](#math)** ([code](lib/math.js) | [unit tests](test/math.js))
* **[misc](#misc)** ([code](lib/misc.js) | [unit tests](test/misc.js))
* **[number](#number)** ([code](lib/number.js) | [unit tests](test/number.js))
* **[object](#object)** ([code](lib/object.js) | [unit tests](test/object.js))
* **[path](#path)** ([code](lib/path.js) | [unit tests](test/path.js))
* **[regex](#regex)** ([code](lib/regex.js) | [unit tests](test/regex.js))
* **[string](#string)** ([code](lib/string.js) | [unit tests](test/string.js))
* **[url](#url)** ([code](lib/url.js) | [unit tests](test/url.js))
## All helpers
### [array helpers](#array)
Visit the: [code](lib/array.js) | [unit tests](test/array.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+array+helpers))
* **[after](#after)** ([code](lib/array.js#L22) | [tests](test/array.js#L13))
* **[arrayify](#arrayify)** ([code](lib/array.js#L39) | [tests](test/array.js#L29))
* **[before](#before)** ([code](lib/array.js#L58) | [tests](test/array.js#L36))
* **[eachIndex](#eachIndex)** ([code](lib/array.js#L77) | [tests](test/array.js#L58))
* **[filter](#filter)** ([code](lib/array.js#L102) | [tests](test/array.js#L91))
* **[first](#first)** ([code](lib/array.js#L142) | [tests](test/array.js#L65))
* **[forEach](#forEach)** ([code](lib/array.js#L184) | [tests](test/array.js#L123))
* **[inArray](#inArray)** ([code](lib/array.js#L224) | [tests](test/array.js#L160))
* **[isArray](#isArray)** ([code](lib/array.js#L244) | [tests](test/array.js#L172))
* **[itemAt](#itemAt)** ([code](lib/array.js#L263) | [tests](test/array.js#L182))
* **[join](#join)** ([code](lib/array.js#L294) | [tests](test/array.js#L225))
* **[equalsLength](#equalsLength)** ([code](lib/array.js#L313) | [no tests])
* **[last](#last)** ([code](lib/array.js#L349) | [tests](test/array.js#L240))
* **[length](#length)** ([code](lib/array.js#L379) | [tests](test/array.js#L254))
* **[lengthEqual](#lengthEqual)** ([code](lib/array.js#L395) | [tests](test/array.js#L254))
* **[map](#map)** ([code](lib/array.js#L414) | [tests](test/array.js#L266))
* **[pluck](#pluck)** ([code](lib/array.js#L445) | [tests](test/array.js#L300))
* **[reverse](#reverse)** ([code](lib/array.js#L473) | [no tests])
* **[some](#some)** ([code](lib/array.js#L504) | [tests](test/array.js#L308))
* **[sort](#sort)** ([code](lib/array.js#L532) | [tests](test/array.js#L333))
* **[sortBy](#sortBy)** ([code](lib/array.js#L557) | [tests](test/array.js#L358))
* **[withAfter](#withAfter)** ([code](lib/array.js#L588) | [tests](test/array.js#L390))
* **[withBefore](#withBefore)** ([code](lib/array.js#L618) | [tests](test/array.js#L397))
* **[withFirst](#withFirst)** ([code](lib/array.js#L648) | [tests](test/array.js#L404))
* **[withGroup](#withGroup)** ([code](lib/array.js#L692) | [tests](test/array.js#L418))
* **[withLast](#withLast)** ([code](lib/array.js#L727) | [tests](test/array.js#L428))
* **[withSort](#withSort)** ([code](lib/array.js#L766) | [tests](test/array.js#L442))
* **[unique](#unique)** ([code](lib/array.js#L816) | [tests](test/array.js#L483))
### [code helpers](#code)
Visit the: [code](lib/code.js) | [unit tests](test/code.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+code+helpers))
* **[embed](#embed)** ([code](lib/code.js#L23) | [tests](test/code.js#L10))
* **[gist](#gist)** ([code](lib/code.js#L45) | [tests](test/code.js#L62))
* **[jsfiddle](#jsfiddle)** ([code](lib/code.js#L60) | [tests](test/code.js#L69))
### [collection helpers](#collection)
Visit the: [code](lib/collection.js) | [unit tests](test/collection.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+collection+helpers))
* **[isEmpty](#isEmpty)** ([code](lib/collection.js#L31) | [tests](test/collection.js#L14))
* **[iterate](#iterate)** ([code](lib/collection.js#L59) | [tests](test/collection.js#L68))
### [comparison helpers](#comparison)
Visit the: [code](lib/comparison.js) | [unit tests](test/comparison.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+comparison+helpers))
* **[and](#and)** ([code](lib/comparison.js#L27) | [tests](test/comparison.js#L10))
* **[compare](#compare)** ([code](lib/comparison.js#L57) | [tests](test/comparison.js#L41))
* **[contains](#contains)** ([code](lib/comparison.js#L124) | [tests](test/comparison.js#L167))
* **[default](#default)** ([code](lib/comparison.js#L143) | [tests](test/comparison.js#L204))
* **[eq](#eq)** ([code](lib/comparison.js#L165) | [tests](test/comparison.js#L351))
* **[gt](#gt)** ([code](lib/comparison.js#L188) | [tests](test/comparison.js#L214))
* **[gte](#gte)** ([code](lib/comparison.js#L212) | [tests](test/comparison.js#L245))
* **[has](#has)** ([code](lib/comparison.js#L232) | [tests](test/comparison.js#L260))
* **[isFalsey](#isFalsey)** ([code](lib/comparison.js#L274) | [tests](test/comparison.js#L327))
* **[isTruthy](#isTruthy)** ([code](lib/comparison.js#L289) | [tests](test/comparison.js#L339))
* **[ifEven](#ifEven)** ([code](lib/comparison.js#L310) | [tests](test/comparison.js#L368))
* **[ifNth](#ifNth)** ([code](lib/comparison.js#L327) | [tests](test/comparison.js#L380))
* **[ifOdd](#ifOdd)** ([code](lib/comparison.js#L350) | [tests](test/comparison.js#L403))
* **[is](#is)** ([code](lib/comparison.js#L274) | [tests](test/comparison.js#L327))
* **[isnt](#isnt)** ([code](lib/comparison.js#L389) | [tests](test/comparison.js#L432))
* **[lt](#lt)** ([code](lib/comparison.js#L411) | [tests](test/comparison.js#L449))
* **[lte](#lte)** ([code](lib/comparison.js#L435) | [tests](test/comparison.js#L476))
* **[neither](#neither)** ([code](lib/comparison.js#L456) | [tests](test/comparison.js#L511))
* **[not](#not)** ([code](lib/comparison.js#L470) | [no tests])
* **[or](#or)** ([code](lib/comparison.js#L492) | [tests](test/comparison.js#L523))
* **[unlessEq](#unlessEq)** ([code](lib/comparison.js#L518) | [tests](test/comparison.js#L556))
* **[unlessGt](#unlessGt)** ([code](lib/comparison.js#L538) | [tests](test/comparison.js#L567))
* **[unlessLt](#unlessLt)** ([code](lib/comparison.js#L558) | [tests](test/comparison.js#L578))
* **[unlessGteq](#unlessGteq)** ([code](lib/comparison.js#L578) | [tests](test/comparison.js#L589))
* **[unlessLteq](#unlessLteq)** ([code](lib/comparison.js#L598) | [tests](test/comparison.js#L604))
### [date helpers](#date)
Visit the: [code](lib/date.js) | [unit tests](test/date.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+date+helpers))
* **[year](#year)** ([code](lib/date.js#L15) | [no tests])
* **[date](#date)** ([code](lib/date.js#Lundefined) | [no tests])
* **[moment](#moment)** ([code](lib/date.js#L24) | [no tests])
### [fs helpers](#fs)
Visit the: [code](lib/fs.js) | [unit tests](test/fs.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+fs+helpers))
* **[fileSize](#fileSize)** ([code](lib/fs.js#L14) | [no tests])
* **[read](#read)** ([code](lib/fs.js#L29) | [tests](test/fs.js#L16))
* **[readdir](#readdir)** ([code](lib/fs.js#L42) | [tests](test/fs.js#L23))
### [html helpers](#html)
Visit the: [code](lib/html.js) | [unit tests](test/html.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+html+helpers))
* **[attr](#attr)** ([code](lib/html.js#L23) | [tests](test/html.js#L13))
* **[css](#css)** ([code](lib/html.js#L45) | [tests](test/html.js#L21))
* **[js](#js)** ([code](lib/html.js#L89) | [tests](test/html.js#L69))
* **[sanitize](#sanitize)** ([code](lib/html.js#L121) | [tests](test/html.js#L98))
* **[ul](#ul)** ([code](lib/html.js#L135) | [tests](test/html.js#L108))
* **[ol](#ol)** ([code](lib/html.js#L154) | [tests](test/html.js#L115))
* **[thumbnailImage](#thumbnailImage)** ([code](lib/html.js#L176) | [tests](test/html.js#L122))
### [i18n helpers](#i18n)
Visit the: [code](lib/i18n.js) | [unit tests](test/i18n.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+i18n+helpers))
* **[i18n](#i18n)** ([code](lib/i18n.js#L18) | [tests](test/i18n.js#L11))
### [inflection helpers](#inflection)
Visit the: [code](lib/inflection.js) | [unit tests](test/inflection.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+inflection+helpers))
* **[inflect](#inflect)** ([code](lib/inflection.js#L30) | [tests](test/inflection.js#L9))
* **[ordinalize](#ordinalize)** ([code](lib/inflection.js#L58) | [tests](test/inflection.js#L22))
### [logging helpers](#logging)
Visit the: [code](lib/logging.js) | [unit tests](test/logging.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+logging+helpers))
* **[log](#log)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[ok](#ok)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[success](#success)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[info](#info)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[warning](#warning)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[warn](#warn)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[error](#error)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[danger](#danger)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[bold](#bold)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[_debug](#_debug)** ([code](lib/logging.js#Lundefined) | [no tests])
* **[_inspect](#_inspect)** ([code](lib/logging.js#Lundefined) | [no tests])
### [markdown helpers](#markdown)
Visit the: [code](lib/markdown.js) | [unit tests](test/markdown.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+markdown+helpers))
* **[markdown](#markdown)** ([code](lib/markdown.js#Lundefined) | [tests](test/markdown.js#L10))
* **[md](#md)** ([code](lib/markdown.js#L55) | [tests](test/markdown.js#L18))
### [match helpers](#match)
Visit the: [code](lib/match.js) | [unit tests](test/match.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+match+helpers))
* **[match](#match)** ([code](lib/match.js#L23) | [tests](test/match.js#L13))
* **[isMatch](#isMatch)** ([code](lib/match.js#L47) | [tests](test/match.js#L61))
* **[mm](#mm)** ([code](lib/match.js#L56) | [no tests])
### [math helpers](#math)
Visit the: [code](lib/math.js) | [unit tests](test/math.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+math+helpers))
* **[abs](#abs)** ([code](lib/math.js#L15) | [no tests])
* **[add](#add)** ([code](lib/math.js#L31) | [tests](test/math.js#L10))
* **[avg](#avg)** ([code](lib/math.js#L54) | [no tests])
* **[ceil](#ceil)** ([code](lib/math.js#L69) | [tests](test/math.js#L29))
* **[divide](#divide)** ([code](lib/math.js#L84) | [tests](test/math.js#L36))
* **[floor](#floor)** ([code](lib/math.js#L102) | [tests](test/math.js#L43))
* **[minus](#minus)** ([code](lib/math.js#L118) | [no tests])
* **[modulo](#modulo)** ([code](lib/math.js#L137) | [no tests])
* **[multiply](#multiply)** ([code](lib/math.js#L157) | [tests](test/math.js#L50))
* **[plus](#plus)** ([code](lib/math.js#L175) | [no tests])
* **[random](#random)** ([code](lib/math.js#L194) | [tests](test/math.js#L102))
* **[remainder](#remainder)** ([code](lib/math.js#L212) | [tests](test/math.js#L57))
* **[round](#round)** ([code](lib/math.js#L224) | [tests](test/math.js#L69))
* **[subtract](#subtract)** ([code](lib/math.js#L241) | [tests](test/math.js#L76))
* **[sum](#sum)** ([code](lib/math.js#L263) | [tests](test/math.js#L83))
* **[times](#times)** ([code](lib/math.js#L286) | [no tests])
### [misc helpers](#misc)
Visit the: [code](lib/misc.js) | [unit tests](test/misc.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+misc+helpers))
* **[frame](#frame)** ([code](lib/misc.js#L11) | [no tests])
* **[option](#option)** ([code](lib/misc.js#L26) | [tests](test/misc.js#L20))
* **[noop](#noop)** ([code](lib/misc.js#L39) | [tests](test/misc.js#L13))
* **[typeOf](#typeOf)** ([code](lib/misc.js#L59) | [no tests])
* **[withHash](#withHash)** ([code](lib/misc.js#L71) | [tests](test/misc.js#L38))
### [number helpers](#number)
Visit the: [code](lib/number.js) | [unit tests](test/number.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+number+helpers))
* **[bytes](#bytes)** ([code](lib/number.js#L24) | [tests](test/number.js#L10))
* **[addCommas](#addCommas)** ([code](lib/number.js#L61) | [tests](test/number.js#L84))
* **[phoneNumber](#phoneNumber)** ([code](lib/number.js#L74) | [tests](test/number.js#L30))
* **[toAbbr](#toAbbr)** ([code](lib/number.js#L92) | [tests](test/number.js#L91))
* **[toExponential](#toExponential)** ([code](lib/number.js#L130) | [tests](test/number.js#L59))
* **[toFixed](#toFixed)** ([code](lib/number.js#L153) | [tests](test/number.js#L37))
* **[toFloat](#toFloat)** ([code](lib/number.js#L169) | [tests](test/number.js#L77))
* **[toInt](#toInt)** ([code](lib/number.js#L179) | [tests](test/number.js#L70))
* **[toPrecision](#toPrecision)** ([code](lib/number.js#L196) | [tests](test/number.js#L48))
### [object helpers](#object)
Visit the: [code](lib/object.js) | [unit tests](test/object.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+object+helpers))
* **[extend](#extend)** ([code](lib/object.js#L18) | [tests](test/object.js#L15))
* **[forIn](#forIn)** ([code](lib/object.js#L55) | [tests](test/object.js#L33))
* **[forOwn](#forOwn)** ([code](lib/object.js#L81) | [tests](test/object.js#L50))
* **[toPath](#toPath)** ([code](lib/object.js#L106) | [tests](test/object.js#L87))
* **[get](#get)** ([code](lib/object.js#L128) | [tests](test/object.js#L77))
* **[getObject](#getObject)** ([code](lib/object.js#L149) | [tests](test/object.js#L77))
* **[hasOwn](#hasOwn)** ([code](lib/object.js#L167) | [tests](test/object.js#L126))
* **[isObject](#isObject)** ([code](lib/object.js#L183) | [tests](test/object.js#L144))
* **[JSONparse](#JSONparse)** ([code](lib/object.js#L201) | [tests](test/object.js#L164))
* **[JSONstringify](#JSONstringify)** ([code](lib/object.js#L218) | [no tests])
* **[merge](#merge)** ([code](lib/object.js#L235) | [tests](test/object.js#L156))
* **[parseJSON](#parseJSON)** ([code](lib/object.js#L254) | [no tests])
* **[pick](#pick)** ([code](lib/object.js#L267) | [tests](test/object.js#L171))
* **[stringify](#stringify)** ([code](lib/object.js#L290) | [tests](test/object.js#L199))
### [path helpers](#path)
Visit the: [code](lib/path.js) | [unit tests](test/path.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+path+helpers))
* **[absolute](#absolute)** ([code](lib/path.js#L20) | [tests](test/path.js#L13))
* **[dirname](#dirname)** ([code](lib/path.js#L40) | [tests](test/path.js#L25))
* **[relative](#relative)** ([code](lib/path.js#L59) | [tests](test/path.js#L32))
* **[basename](#basename)** ([code](lib/path.js#L81) | [tests](test/path.js#L47))
* **[stem](#stem)** ([code](lib/path.js#L100) | [tests](test/path.js#L58))
* **[extname](#extname)** ([code](lib/path.js#L119) | [tests](test/path.js#L69))
* **[resolve](#resolve)** ([code](lib/path.js#L138) | [no tests])
* **[segments](#segments)** ([code](lib/path.js#L166) | [tests](test/path.js#L80))
### [regex helpers](#regex)
Visit the: [code](lib/regex.js) | [unit tests](test/regex.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+regex+helpers))
* **[toRegex](#toRegex)** ([code](lib/regex.js#L19) | [no tests])
* **[test](#test)** ([code](lib/regex.js#L42) | [no tests])
### [string helpers](#string)
Visit the: [code](lib/string.js) | [unit tests](test/string.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+string+helpers))
* **[append](#append)** ([code](lib/string.js#L22) | [no tests])
* **[camelcase](#camelcase)** ([code](lib/string.js#L41) | [tests](test/string.js#L10))
* **[capitalize](#capitalize)** ([code](lib/string.js#L60) | [tests](test/string.js#L25))
* **[capitalizeAll](#capitalizeAll)** ([code](lib/string.js#L77) | [tests](test/string.js#L36))
* **[center](#center)** ([code](lib/string.js#L95) | [tests](test/string.js#L47))
* **[chop](#chop)** ([code](lib/string.js#L125) | [tests](test/string.js#L58))
* **[dashcase](#dashcase)** ([code](lib/string.js#L143) | [tests](test/string.js#L73))
* **[dotcase](#dotcase)** ([code](lib/string.js#L162) | [tests](test/string.js#L88))
* **[downcase](#downcase)** ([code](lib/string.js#L182) | [no tests])
* **[ellipsis](#ellipsis)** ([code](lib/string.js#L202) | [tests](test/string.js#L103))
* **[hyphenate](#hyphenate)** ([code](lib/string.js#L223) | [tests](test/string.js#L118))
* **[isString](#isString)** ([code](lib/string.js#L240) | [tests](test/string.js#L129))
* **[lowercase](#lowercase)** ([code](lib/string.js#L256) | [tests](test/string.js#L151))
* **[occurrences](#occurrences)** ([code](lib/string.js#L278) | [tests](test/string.js#L162))
* **[pascalcase](#pascalcase)** ([code](lib/string.js#L303) | [tests](test/string.js#L173))
* **[pathcase](#pathcase)** ([code](lib/string.js#L323) | [tests](test/string.js#L188))
* **[plusify](#plusify)** ([code](lib/string.js#L343) | [tests](test/string.js#L203))
* **[prepend](#prepend)** ([code](lib/string.js#L363) | [no tests])
* **[raw](#raw)** ([code](lib/string.js#L385) | [no tests])
* **[remove](#remove)** ([code](lib/string.js#L413) | [no tests])
* **[removeFirst](#removeFirst)** ([code](lib/string.js#L432) | [no tests])
* **[replace](#replace)** ([code](lib/string.js#L452) | [tests](test/string.js#L222))
* **[replaceFirst](#replaceFirst)** ([code](lib/string.js#L473) | [no tests])
* **[reverse](#reverse)** ([code](lib/string.js#L492) | [tests](test/string.js#L241))
* **[sentence](#sentence)** ([code](lib/string.js#L509) | [tests](test/string.js#L252))
* **[snakecase](#snakecase)** ([code](lib/string.js#L528) | [tests](test/string.js#L263))
* **[split](#split)** ([code](lib/string.js#L547) | [tests](test/string.js#L278))
* **[startsWith](#startsWith)** ([code](lib/string.js#L572) | [tests](test/string.js#L293))
* **[titleize](#titleize)** ([code](lib/string.js#L596) | [tests](test/string.js#L312))
* **[trim](#trim)** ([code](lib/string.js#L623) | [tests](test/string.js#L323))
* **[trimLeft](#trimLeft)** ([code](lib/string.js#L639) | [no tests])
* **[trimRight](#trimRight)** ([code](lib/string.js#L657) | [no tests])
* **[truncate](#truncate)** ([code](lib/string.js#L680) | [tests](test/string.js#L338))
* **[truncateWords](#truncateWords)** ([code](lib/string.js#L712) | [no tests])
* **[upcase](#upcase)** ([code](lib/string.js#L742) | [no tests])
* **[uppercase](#uppercase)** ([code](lib/string.js#L763) | [tests](test/string.js#L362))
### [url helpers](#url)
Visit the: [code](lib/url.js) | [unit tests](test/url.js) | [issues](https://github.com/helpers/handlebars-helpers/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+url+helpers))
* **[encodeURI](#encodeURI)** ([code](lib/url.js#L19) | [tests](test/url.js#L31))
* **[escape](#escape)** ([code](lib/url.js#L34) | [no tests])
* **[decodeURI](#decodeURI)** ([code](lib/url.js#L48) | [tests](test/url.js#L38))
* **[url_encode](#url_encode)** ([code](lib/url.js#L59) | [no tests])
* **[url_decode](#url_decode)** ([code](lib/url.js#L68) | [no tests])
* **[urlResolve](#urlResolve)** ([code](lib/url.js#L82) | [tests](test/url.js#L11))
* **[urlParse](#urlParse)** ([code](lib/url.js#L94) | [tests](test/url.js#L45))
* **[stripQuerystring](#stripQuerystring)** ([code](lib/url.js#L106) | [tests](test/url.js#L24))
* **[stripProtocol](#stripProtocol)** ([code](lib/url.js#L126) | [no tests])
***
## array
### [{{after}}](lib/array.js#L22)
Returns all of the items in an array after the specified index. Opposite of [before](#before).
**Params**
* `array` **{Array}**: Collection
* `n` **{Number}**: Starting index (number of items to exclude)
* `returns` **{Array}**: Array exluding `n` items.
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{after array 1}}
<!-- results in: '["c"]' -->
```
### [{{arrayify}}](lib/array.js#L39)
Cast the given `value` to an array.
**Params**
* `value` **{any}**
* `returns` **{Array}**
**Example**
```handlebars
{{arrayify "foo"}}
<!-- results in: [ "foo" ] -->
```
### [{{before}}](lib/array.js#L58)
Return all of the items in the collection before the specified count. Opposite of [after](#after).
**Params**
* `array` **{Array}**
* `n` **{Number}**
* `returns` **{Array}**: Array excluding items after the given number.
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{before array 2}}
<!-- results in: '["a", "b"]' -->
```
### [{{eachIndex}}](lib/array.js#L77)
**Params**
* `array` **{Array}**
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] -->
{{#eachIndex array}}
{{item}} is {{index}}
{{/eachIndex}}
```
### [{{filter}}](lib/array.js#L102)
Block helper that filters the given array and renders the block for values that evaluate to `true`, otherwise the inverse block is returned.
**Params**
* `array` **{Array}**
* `value` **{any}**
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{#filter array "foo"}}AAA{{else}}BBB{{/filter}}
<!-- results in: 'BBB' -->
```
### [{{first}}](lib/array.js#L142)
Returns the first item, or first `n` items of an array.
**Params**
* `array` **{Array}**
* `n` **{Number}**: Number of items to return, starting at `0`.
* `returns` **{Array}**
**Example**
```handlebars
{{first "['a', 'b', 'c', 'd', 'e']" 2}}
<!-- results in: '["a", "b"]' -->
```
### [{{forEach}}](lib/array.js#L184)
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:
* `index`
* `total`
* `isFirst`
* `isLast`
Also, `@index` is exposed as a private variable, and additional
private variables may be defined as hash arguments.
**Params**
* `array` **{Array}**
* `returns` **{String}**
**Example**
```handlebars
<!-- accounts = [
{'name': 'John', 'email': 'john@example.com'},
{'name': 'Malcolm', 'email': 'malcolm@example.com'},
{'name': 'David', 'email': 'david@example.com'}
] -->
{{#forEach accounts}}
<a href="mailto:{{ email }}" title="Send an email to {{ name }}">
{{ name }}
</a>{{#unless isLast}}, {{/unless}}
{{/forEach}}
```
### [{{inArray}}](lib/array.js#L224)
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.
**Params**
* `array` **{Array}**
* `value` **{any}**
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{#inArray array "d"}}
foo
{{else}}
bar
{{/inArray}}
<!-- results in: 'bar' -->
```
### [{{isArray}}](lib/array.js#L244)
Returns true if `value` is an es5 array.
**Params**
* `value` **{any}**: The value to test.
* `returns` **{Boolean}**
**Example**
```handlebars
{{isArray "abc"}}
<!-- results in: false -->
<!-- array: [1, 2, 3] -->
{{isArray array}}
<!-- results in: true -->
```
### [{{itemAt}}](lib/array.js#L263)
Returns the item from `array` at index `idx`.
**Params**
* `array` **{Array}**
* `idx` **{Number}**
* `returns` **{any}** `value`
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{itemAt array 1}}
<!-- results in: 'b' -->
```
### [{{join}}](lib/array.js#L294)
Join all elements of array into a string, optionally using a given separator.
**Params**
* `array` **{Array}**
* `separator` **{String}**: The separator to use. Defaults to `,`.
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{join array}}
<!-- results in: 'a, b, c' -->
{{join array '-'}}
<!-- results in: 'a-b-c' -->
```
### [{{equalsLength}}](lib/array.js#L313)
Returns true if the the length of the given `value` is equal
to the given `length`. Can be used as a block or inline helper.
**Params**
* `value` **{Array|String}**
* `length` **{Number}**
* `options` **{Object}**
* `returns` **{String}**
### [{{last}}](lib/array.js#L349)
Returns the last item, or last `n` items of an array or string. Opposite of [first](#first).
**Params**
* `value` **{Array|String}**: Array or string.
* `n` **{Number}**: Number of items to return from the end of the array.
* `returns` **{Array}**
**Example**
```handlebars
<!-- var value = ['a', 'b', 'c', 'd', 'e'] -->
{{last value}}
<!-- results in: ['e'] -->
{{last value 2}}
<!-- results in: ['d', 'e'] -->
{{last value 3}}
<!-- results in: ['c', 'd', 'e'] -->
```
### [{{length}}](lib/array.js#L379)
Returns the length of the given string or array.
**Params**
* `value` **{Array|Object|String}**
* `returns` **{Number}**: The length of the value.
**Example**
```handlebars
{{length '["a", "b", "c"]'}}
<!-- results in: 3 -->
<!-- results in: myArray = ['a', 'b', 'c', 'd', 'e']; -->
{{length myArray}}
<!-- results in: 5 -->
<!-- results in: myObject = {'a': 'a', 'b': 'b'}; -->
{{length myObject}}
<!-- results in: 2 -->
```
### [{{lengthEqual}}](lib/array.js#L395)
Alias for [equalsLength](#equalsLength)
### [{{map}}](lib/array.js#L414)
Returns a new array, created by calling `function` on each element of the given `array`. For example,
**Params**
* `array` **{Array}**
* `fn` **{Function}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'], and "double" is a
fictitious function that duplicates letters -->
{{map array double}}
<!-- results in: '["aa", "bb", "cc"]' -->
```
### [{{pluck}}](lib/array.js#L445)
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.
**Params**
* `collection` **{Array|Object}**
* `prop` **{Function}**
* `returns` **{String}**
**Example**
```handlebars
// {{pluck items "data.title"}}
<!-- results in: '["aa", "bb", "cc"]' -->
```
### [{{reverse}}](lib/array.js#L473)
Reverse the elements in an array, or the characters in a string.
**Params**
* `value` **{Array|String}**
* `returns` **{Array|String}**: Returns the reversed string or array.
**Example**
```handlebars
<!-- value: 'abcd' -->
{{reverse value}}
<!-- results in: 'dcba' -->
<!-- value: ['a', 'b', 'c', 'd'] -->
{{reverse value}}
<!-- results in: ['d', 'c', 'b', 'a'] -->
```
### [{{some}}](lib/array.js#L504)
Block helper that returns the block if the callback returns true for some value in the given array.
**Params**
* `array` **{Array}**
* `iter` **{Function}**: Iteratee
* **{Options}**: Handlebars provided options object
* `returns` **{String}**
**Example**
```handlebars
<!-- array: [1, 'b', 3] -->
{{#some array isString}}
Render me if the array has a string.
{{else}}
Render me if it doesn't.
{{/some}}
<!-- results in: 'Render me if the array has a string.' -->
```
### [{{sort}}](lib/array.js#L532)
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.
**Params**
* `array` **{Array}**: the array to sort.
* `key` **{String|Function}**: The object key to sort by, or sorting function.
**Example**
```handlebars
<!-- array: ['b', 'a', 'c'] -->
{{sort array}}
<!-- results in: '["a", "b", "c"]' -->
```
### [{{sortBy}}](lib/array.js#L557)
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.
**Params**
* `array` **{Array}**: the array to sort.
* `props` **{String|Function}**: One or more properties to sort by, or sorting functions to use.
**Example**
```handlebars
<!-- array: [{a: 'zzz'}, {a: 'aaa'}] -->
{{sortBy array "a"}}
<!-- results in: '[{"a":"aaa"}, {"a":"zzz"}]' -->
```
### [{{withAfter}}](lib/array.js#L588)
Use the items in the array _after_ the specified index as context inside a block. Opposite of [withBefore](#withBefore).
**Params**
* `array` **{Array}**
* `idx` **{Number}**
* `options` **{Object}**
* `returns` **{Array}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c', 'd', 'e'] -->
{{#withAfter array 3}}
{{this}}
{{/withAfter}}
<!-- results in: "de" -->
```
### [{{withBefore}}](lib/array.js#L618)
Use the items in the array _before_ the specified index as context inside a block. Opposite of [withAfter](#withAfter).
**Params**
* `array` **{Array}**
* `idx` **{Number}**
* `options` **{Object}**
* `returns` **{Array}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c', 'd', 'e'] -->
{{#withBefore array 3}}
{{this}}
{{/withBefore}}
<!-- results in: 'ab' -->
```
### [{{withFirst}}](lib/array.js#L648)
Use the first item in a collection inside a handlebars block expression. Opposite of [withLast](#withLast).
**Params**
* `array` **{Array}**
* `idx` **{Number}**
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{#withFirst array}}
{{this}}
{{/withFirst}}
<!-- results in: 'a' -->
```
### [{{withGroup}}](lib/array.js#L692)
Block helper that groups array elements by given group `size`.
**Params**
* `array` **{Array}**: The array to iterate over
* `size` **{Number}**: The desired length of each array "group"
* `options` **{Object}**: Handlebars options
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a','b','c','d','e','f','g','h'] -->
{{#withGroup array 4}}
{{#each this}}
{{.}}
{{each}}
<br>
{{/withGroup}}
<!-- results in: -->
<!-- 'a','b','c','d'<br> -->
<!-- 'e','f','g','h'<br> -->
```
### [{{withLast}}](lib/array.js#L727)
Use the last item or `n` items in an array as context inside a block. Opposite of [withFirst](#withFirst).
**Params**
* `array` **{Array}**
* `idx` **{Number}**: The starting index.
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['a', 'b', 'c'] -->
{{#withLast array}}
{{this}}
{{/withLast}}
<!-- results in: 'c' -->
```
### [{{withSort}}](lib/array.js#L766)
Block helper that sorts a collection and exposes the sorted collection as context inside the block.
**Params**
* `array` **{Array}**
* `prop` **{String}**
* `options` **{Object}**: Specify `reverse="true"` to reverse the array.
* `returns` **{String}**
**Example**
```handlebars
<!-- array: ['b', 'a', 'c'] -->
{{#withSort array}}{{this}}{{/withSort}}
<!-- results in: 'abc' -->
```
### [{{unique}}](lib/array.js#L816)
Block helper that return an array with all duplicate values removed. Best used along with a [each](#each) helper.
**Params**
* `array` **{Array}**
* `options` **{Object}**
* `returns` **{Array}**
**Example**
```handlebars
<!-- array: ['a', 'a', 'c', 'b', 'e', 'e'] -->
{{#each (unique array)}}{{.}}{{/each}}
<!-- results in: 'acbe' -->
```
## code
### [{{embed}}](lib/code.js#L23)
Embed code from an external file as preformatted text.
**Params**
* `filepath` **{String}**: filepath to the file to embed.
* `language` **{String}**: Optionally specify the language to use for syntax highlighting.
* `returns` **{String}**
**Example**
```handlebars
{{embed 'path/to/file.js'}}
<!-- optionally specify the language to use -->
{{embed 'path/to/file.hbs' 'html')}}
```
### [{{gist}}](lib/code.js#L45)
Embed a GitHub Gist using only the id of the Gist
**Params**
* `id` **{String}**
* `returns` **{String}**
**Example**
```handlebars
{{gist "12345"}}
```
### [{{jsfiddle}}](lib/code.js#L60)
Generate the HTML for a jsFiddle link with the given `params`
**Params**
* `params` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
{{jsfiddle id="0dfk10ks" tabs="true"}}
```
## collection
### [{{isEmpty}}](lib/collection.js#L31)
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.
**Params**
* `collection` **{Object}**
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- array: [] -->
{{#isEmpty array}}AAA{{else}}BBB{{/isEmpty}}
<!-- results in: 'AAA' -->
<!-- array: [] -->
{{isEmpty array}}
<!-- results in: true -->
```
### [{{iterate}}](lib/collection.js#L59)
Block helper that iterates over an array or object. If
an array is given, `.forEach` is called, or if an object
is given, `.forOwn` is called, otherwise the inverse block
is returned.
**Params**
* `collection` **{Object|Array}**: The collection to iterate over
* `options` **{Object}**
* `returns` **{String}**
## comparison
### [{{and}}](lib/comparison.js#L27)
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.
**Params**
* `a` **{any}**
* `b` **{any}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**
**Example**
```handlebars
<!-- {great: true, magnificent: true} -->
{{#and great magnificent}}A{{else}}B{{/and}}
<!-- results in: 'A' -->
```
### [{{compare}}](lib/comparison.js#L57)
Render a block when a comparison of the first and third
arguments returns true. The second argument is
the [arithemetic operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators) to use. You may also
optionally specify an inverse block to render when falsy.
**Params**
* `a` **{}**
* `operator` **{}**: The operator to use. Operators must be enclosed in quotes: `">"`, `"="`, `"<="`, and so on.
* `b` **{}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or if specified the inverse block is rendered if falsey.
### [{{contains}}](lib/comparison.js#L124)
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.
**Params**
* `collection` **{Array|Object|String}**: The collection to iterate over.
* `value` **{any}**: The value to check for.
* `[startIndex=0]` **{Number}**: Optionally define the starting index.
* `options` **{Object}**: Handlebars provided options object.
**Example**
```handlebars
<!-- array = ['a', 'b', 'c'] -->
{{#contains array "d"}}
This will not be rendered.
{{else}}
This will be rendered.
{{/contains}}
```
### [{{default}}](lib/comparison.js#L143)
Returns the first value that is not undefined, otherwise the "default" value is returned.
**Params**
* `value` **{any}**
* `defaultValue` **{any}**
* `returns` **{String}**
### [{{eq}}](lib/comparison.js#L165)
Block helper that renders a block if `a` is **equal to** `b`.
If an inverse block is specified it will be rendered when falsy.
You may optionally use the `compare=""` hash argument for the
second value.
**Params**
* `a` **{String}**
* `b` **{String}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{gt}}](lib/comparison.js#L188)
Block helper that renders a block if `a` is **greater than** `b`.
If an inverse block is specified it will be rendered when falsy.
You may optionally use the `compare=""` hash argument for the
second value.
**Params**
* `a` **{String}**
* `b` **{String}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{gte}}](lib/comparison.js#L212)
Block helper that renders a block if `a` is **greater than or equal to** `b`.
If an inverse block is specified it will be rendered when falsy.
You may optionally use the `compare=""` hash argument for the
second value.
**Params**
* `a` **{String}**
* `b` **{String}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{has}}](lib/comparison.js#L232)
Block helper that renders a block if `value` has `pattern`.
If an inverse block is specified it will be rendered when falsy.
**Params**
* `val` **{any}**: The value to check.
* `pattern` **{any}**: The pattern to check for.
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**
### [{{isFalsey}}](lib/comparison.js#L274)
Returns true if the given `value` is falsey. Uses the [falsey](https://github.com/jonschlinkert/falsey)
library for comparisons. Please see that library for more information
or to report bugs with this helper.
**Params**
* `val` **{any}**
* `options` **{Options}**
* `returns` **{Boolean}**
### [{{isTruthy}}](lib/comparison.js#L289)
Returns true if the given `value` is truthy. Uses the [falsey](https://github.com/jonschlinkert/falsey)
library for comparisons. Please see that library for more information
or to report bugs with this helper.
**Params**
* `val` **{any}**
* `options` **{Options}**
* `returns` **{Boolean}**
### [{{ifEven}}](lib/comparison.js#L310)
Return true if the given value is an even number.
**Params**
* `number` **{Number}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
**Example**
```handlebars
{{#ifEven value}}
render A
{{else}}
render B
{{/ifEven}}
```
### [{{ifNth}}](lib/comparison.js#L327)
Conditionally renders a block if the remainder is zero when
`a` operand is divided by `b`. If an inverse block is specified
it will be rendered when the remainder is **not zero**.
**Params**
* **{}**: {Number}
* **{}**: {Number}
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{ifOdd}}](lib/comparison.js#L350)
Block helper that renders a block if `value` is **an odd number**. If an inverse block is specified it will be rendered when falsy.
**Params**
* `value` **{Object}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
**Example**
```handlebars
{{#ifOdd value}}
render A
{{else}}
render B
{{/ifOdd}}
```
### [{{is}}](lib/comparison.js#L367)
Block helper that renders a block if `a` is **equal to** `b`.
If an inverse block is specified it will be rendered when falsy.
Similar to [eq](#eq) but does not do strict equality.
**Params**
* `a` **{any}**
* `b` **{any}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**
### [{{isnt}}](lib/comparison.js#L389)
Block helper that renders a block if `a` is **not equal to** `b`.
If an inverse block is specified it will be rendered when falsy.
Similar to [unlessEq](#unlesseq) but does not use strict equality for
comparisons.
**Params**
* `a` **{String}**
* `b` **{String}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**
### [{{lt}}](lib/comparison.js#L411)
Block helper that renders a block if `a` is **less than** `b`.
If an inverse block is specified it will be rendered when falsy.
You may optionally use the `compare=""` hash argument for the
second value.
**Params**
* `context` **{Object}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{lte}}](lib/comparison.js#L435)
Block helper that renders a block if `a` is **less than or equal to** `b`.
If an inverse block is specified it will be rendered when falsy.
You may optionally use the `compare=""` hash argument for the
second value.
**Params**
* `a` **{Sring}**
* `b` **{Sring}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{neither}}](lib/comparison.js#L456)
Block helper that renders a block if **neither of** the given values
are truthy. If an inverse block is specified it will be rendered
when falsy.
**Params**
* `a` **{any}**
* `b` **{any}**
* `options` **{}**: Handlebars options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{not}}](lib/comparison.js#L470)
Returns true if `val` is falsey. Works as a block or inline helper.
**Params**
* `val` **{String}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**
### [{{or}}](lib/comparison.js#L492)
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.
**Params**
* `arguments` **{...any}**: Variable number of arguments
* `options` **{Object}**: Handlebars options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
**Example**
```handlebars
{{#or a b c}}
If any value is true this will be rendered.
{{/or}}
```
### [{{unlessEq}}](lib/comparison.js#L518)
Block helper that always renders the inverse block **unless `a` is
is equal to `b`**.
**Params**
* `a` **{String}**
* `b` **{String}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Inverse block by default, or block if falsey.
### [{{unlessGt}}](lib/comparison.js#L538)
Block helper that always renders the inverse block **unless `a` is
is greater than `b`**.
**Params**
* `a` **{Object}**: The default value
* `b` **{Object}**: The value to compare
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Inverse block by default, or block if falsey.
### [{{unlessLt}}](lib/comparison.js#L558)
Block helper that always renders the inverse block **unless `a` is
is less than `b`**.
**Params**
* `a` **{Object}**: The default value
* `b` **{Object}**: The value to compare
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{unlessGteq}}](lib/comparison.js#L578)
Block helper that always renders the inverse block **unless `a` is
is greater than or equal to `b`**.
**Params**
* `a` **{any}**
* `b` **{any}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
### [{{unlessLteq}}](lib/comparison.js#L598)
Block helper that always renders the inverse block **unless `a` is
is less than or equal to `b`**.
**Params**
* `a` **{any}**
* `b` **{any}**
* `options` **{Object}**: Handlebars provided options object
* `returns` **{String}**: Block, or inverse block if specified and falsey.
## date
### [{{year}}](lib/date.js#L15)
Get the current year.
**Example**
```handlebars
{{year}}
<!-- 2017 -->
```
### [{{moment}}](lib/date.js#L24)
Use [moment](http://momentjs.com) as a helper. See [helper-date](https://github.com/helpers/helper-date) for more details.
## fs
### [{{read}}](lib/fs.js#L29)
Read a file from the file system. This is useful in composing "include"-style helpers using sub-expressions.
**Params**
* `filepath` **{String}**
* `returns` **{String}**
**Example**
```handlebars
{{read "a/b/c.js"}}
{{someHelper (read "a/b/c.md")}}
```
### [{{readdir}}](lib/fs.js#L42)
Return an array of files from the given
directory.
**Params**
* `directory` **{String}**
* `returns` **{Array}**
## html
### [{{attr}}](lib/html.js#L23)
Stringify attributes on the options `hash`.
**Params**
* `options` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
<!-- value = 'bar' -->
<div{{attr foo=value}}></div>
<!-- results in: <div foo="bar"></div>
```
### [{{css}}](lib/html.js#L45)
Add an array of `<link>` tags. Automatically resolves relative paths to `options.assets` if passed on the context.
**Params**
* `list` **{String|Array}**: One or more stylesheet urls.
* `returns` **{String}**
**Example**
```handlebars
<!-- {stylesheets: ['foo.css', 'bar.css']} -->
{{css stylesheets}}
<!-- results in: -->
<!-- <link type="text/css" rel="stylesheet" href="foo.css"> -->
<!-- <link type="text/css" rel="stylesheet" href="bar.css"> -->
```
### [{{js}}](lib/html.js#L89)
Generate one or more `<script></script>` tags with paths/urls to javascript or coffeescript files.
**Params**
* `context` **{Object}**
* `returns` **{String}**
**Example**
```handlebars
{{js scripts}}
```
### [{{sanitize}}](lib/html.js#L121)
Strip HTML tags from a string, so that only the text nodes are preserved.
**Params**
* `str` **{String}**: The string of HTML to sanitize.
* `returns` **{String}**
**Example**
```handlebars
{{sanitize "<span>foo</span>"}}
<!-- results in: 'foo' -->
```
### [{{ul}}](lib/html.js#L135)
Block helper for creating unordered lists (`<ul></ul>`)
**Params**
* `context` **{Object}**
* `options` **{Object}**
* `returns` **{String}**
### [{{ol}}](lib/html.js#L154)
Block helper for creating ordered lists (`<ol></ol>`)
**Params**
* `context` **{Object}**
* `options` **{Object}**
* `returns` **{String}**
### [{{thumbnailImage}}](lib/html.js#L176)
Returns a `<figure>` with a thumbnail linked to a full picture
**Params**
* `context` **{Object}**: Object with values/attributes to add to the generated elements:
* `context.alt` **{String}**
* `context.src` **{String}**
* `context.width` **{Number}**
* `context.height` **{Number}**
* `returns` **{String}**: HTML `<figure>` element with image and optional caption/link.
## i18n
### [{{i18n}}](lib/i18n.js#L18)
i18n helper. See [button-i18n](https://github.com/assemble/buttons)
for a working example.
**Params**
* `key` **{String}**
* `options` **{Object}**
* `returns` **{String}**
## inflection
### [{{inflect}}](lib/inflection.js#