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.
Install with npm:
$ npm install --save handlebars-helpers
Install with yarn:
$ yarn add handlebars-helpers
See how to use handlebars-helpers in the browser.
The main export returns a function that needs to be called to expose the object of helpers.
Get all helpers
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.
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.
var helpers = require('handlebars-helpers')(['math', 'string']);
//=> only the `math` and `string` helpers
Optionally pass your own handlebars
var handlebars = require('handlebars');
var helpers = require('handlebars-helpers')({
handlebars: handlebars
});
// or for a specific collection
var math = helpers.math({
handlebars: handlebars
});
Currently 189 helpers in 20 categories:
- array (code | unit tests)
- code (code | unit tests)
- collection (code | unit tests)
- comparison (code | unit tests)
- date (code | unit tests)
- fs (code | unit tests)
- html (code | unit tests)
- i18n (code | unit tests)
- inflection (code | unit tests)
- logging (code | unit tests)
- markdown (code | unit tests)
- match (code | unit tests)
- math (code | unit tests)
- misc (code | unit tests)
- number (code | unit tests)
- object (code | unit tests)
- path (code | unit tests)
- regex (code | unit tests)
- string (code | unit tests)
- url (code | unit tests)
Visit the: code | unit tests | issues)
- after (code | tests)
- arrayify (code | tests)
- before (code | tests)
- eachIndex (code | tests)
- filter (code | tests)
- first (code | tests)
- forEach (code | tests)
- inArray (code | tests)
- isArray (code | tests)
- itemAt (code | tests)
- join (code | tests)
- equalsLength (code | [no tests])
- last (code | tests)
- length (code | tests)
- lengthEqual (code | tests)
- map (code | tests)
- pluck (code | tests)
- reverse (code | [no tests])
- some (code | tests)
- sort (code | tests)
- sortBy (code | tests)
- withAfter (code | tests)
- withBefore (code | tests)
- withFirst (code | tests)
- withGroup (code | tests)
- withLast (code | tests)
- withSort (code | tests)
- unique (code | tests)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
- and (code | tests)
- compare (code | tests)
- contains (code | tests)
- default (code | tests)
- eq (code | tests)
- gt (code | tests)
- gte (code | tests)
- has (code | tests)
- isFalsey (code | tests)
- isTruthy (code | tests)
- ifEven (code | tests)
- ifNth (code | tests)
- ifOdd (code | tests)
- is (code | tests)
- isnt (code | tests)
- lt (code | tests)
- lte (code | tests)
- neither (code | tests)
- not (code | [no tests])
- or (code | tests)
- unlessEq (code | tests)
- unlessGt (code | tests)
- unlessLt (code | tests)
- unlessGteq (code | tests)
- unlessLteq (code | tests)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
- attr (code | tests)
- css (code | tests)
- js (code | tests)
- sanitize (code | tests)
- ul (code | tests)
- ol (code | tests)
- thumbnailImage (code | tests)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
- log (code | [no tests])
- ok (code | [no tests])
- success (code | [no tests])
- info (code | [no tests])
- warning (code | [no tests])
- warn (code | [no tests])
- error (code | [no tests])
- danger (code | [no tests])
- bold (code | [no tests])
- _debug (code | [no tests])
- _inspect (code | [no tests])
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
- abs (code | [no tests])
- add (code | tests)
- avg (code | [no tests])
- ceil (code | tests)
- divide (code | tests)
- floor (code | tests)
- minus (code | [no tests])
- modulo (code | [no tests])
- multiply (code | tests)
- plus (code | [no tests])
- random (code | tests)
- remainder (code | tests)
- round (code | tests)
- subtract (code | tests)
- sum (code | tests)
- times (code | [no tests])
Visit the: code | unit tests | issues)
- frame (code | [no tests])
- option (code | tests)
- noop (code | tests)
- typeOf (code | [no tests])
- withHash (code | tests)
Visit the: code | unit tests | issues)
- bytes (code | tests)
- addCommas (code | tests)
- phoneNumber (code | tests)
- toAbbr (code | tests)
- toExponential (code | tests)
- toFixed (code | tests)
- toFloat (code | tests)
- toInt (code | tests)
- toPrecision (code | tests)
Visit the: code | unit tests | issues)
- extend (code | tests)
- forIn (code | tests)
- forOwn (code | tests)
- toPath (code | tests)
- get (code | tests)
- getObject (code | tests)
- hasOwn (code | tests)
- isObject (code | tests)
- JSONparse (code | tests)
- JSONstringify (code | [no tests])
- merge (code | tests)
- parseJSON (code | [no tests])
- pick (code | tests)
- stringify (code | tests)
Visit the: code | unit tests | issues)
- absolute (code | tests)
- dirname (code | tests)
- relative (code | tests)
- basename (code | tests)
- stem (code | tests)
- extname (code | tests)
- resolve (code | [no tests])
- segments (code | tests)
Visit the: code | unit tests | issues)
Visit the: code | unit tests | issues)
- append (code | [no tests])
- camelcase (code | tests)
- capitalize (code | tests)
- capitalizeAll (code | tests)
- center (code | tests)
- chop (code | tests)
- dashcase (code | tests)
- dotcase (code | tests)
- downcase (code | [no tests])
- ellipsis (code | tests)
- hyphenate (code | tests)
- isString (code | tests)
- lowercase (code | tests)
- occurrences (code | tests)
- pascalcase (code | tests)
- pathcase (code | tests)
- plusify (code | tests)
- prepend (code | [no tests])
- raw (code | [no tests])
- remove (code | [no tests])
- removeFirst (code | [no tests])
- replace (code | tests)
- replaceFirst (code | [no tests])
- reverse (code | tests)
- sentence (code | tests)
- snakecase (code | tests)
- split (code | tests)
- startsWith (code | tests)
- titleize (code | tests)
- trim (code | tests)
- trimLeft (code | [no tests])
- trimRight (code | [no tests])
- truncate (code | tests)
- truncateWords (code | [no tests])
- upcase (code | [no tests])
- uppercase (code | tests)
Visit the: code | unit tests | issues)
- encodeURI (code | tests)
- escape (code | [no tests])
- decodeURI (code | tests)
- url_encode (code | [no tests])
- url_decode (code | [no tests])
- urlResolve (code | tests)
- urlParse (code | tests)
- stripQuerystring (code | tests)
- stripProtocol (code | [no tests])
Returns all of the items in an array after the specified index. Opposite of before.
Params
array
{Array}: Collectionn
{Number}: Starting index (number of items to exclude)returns
{Array}: Array exludingn
items.
Example
Cast the given value
to an array.
Params
value
{any}returns
{Array}
Example
Return all of the items in the collection before the specified count. Opposite of after.
Params
array
{Array}n
{Number}returns
{Array}: Array excluding items after the given number.
Example