Default Helpers

length

Returns the length of the given string or array.

Params

  • value {Array|Object|String}

  • returns {Number}: The length of the value.

default

Returns the first value that is not undefined, otherwise the "default" value is returned.

Params

  • value {any}

  • defaultValue {any}

  • returns {String}

eq

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

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.

lt

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

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.

gte

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.

ternary

Returns either of the two values provided based on the condition given.

Params

  • Condition {Boolean}

  • trueValue {String | Number}

  • falseValue {String | Number}

  • returns {String | Number}

isnt

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.

Params

  • a {String}

  • b {String}

  • options {Object}: Handlebars provided options object

  • returns {String}

not

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

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.

and

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}

startsWith

Block helper which tests whether a string begins with the given prefix and render as if and else.

Params

  • prefix {String}

  • testString {String}

  • options {String}

  • returns {String}

ellipsis

Truncates a string to the specified length, and appends it with an elipsis, (…).

Params

  • str {String}

  • length {Number}: The desired length of the returned string.

  • returns {String}: The truncated string.

replace

Replace all occurrences of substring a with substring b.

Params

  • str {String}

  • a {String}

  • b {String}

  • returns {String}

lowercase

Lowercase all characters in the given string.

Params

  • str {String}

  • returns {String}

uppercase

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.

Params

  • str {String}: The string to uppercase

  • options {Object}: Handlebars options object

  • returns {String}

titleize

Title case the given string. From “this is sample text” to “This Is Sample Text”

Params

  • str {String}

  • returns {String}

isEmpty

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 collection is not empty.

Params

  • collection {Object}

  • options {Object}

  • returns {String}

isObject

Return true if value is an object.

Params

  • value {String}

  • returns {Boolean}

isNumber

Return true if value is an object.

Params

  • value {String | Number}

  • returns {Boolean}