Misc Helpers

Handlebars provides a set of built-in helpers for working with miscellaneous tasks. These helpers are used to perform various operations, making it easier to manipulate data in templates.

misc

{{frame}}

Block helper for exposing private @ variables on the context. Creates a new data frame and extends it with hash arguments.

Params

  • context {Object}: Optional context data to include in the frame
  • options {Object}: Handlebars provided options object
  • returns {String}: Block content with the new frame context

Example

{{#frame site="mysite" value=42}}
  {{@site}} - {{@value}}
{{/frame}}

{{option}}

Return the given value of prop from this.options.

Params

  • prop {String}
  • returns {any}

Example


{{option "a.b.c"}}

{{noop}}

Block helper that renders the block without taking any arguments.

Params

  • options {Object}
  • returns {String}

{{typeOf}}

Get the native type of the given value.

Params

  • value {any}
  • returns {String}: Returns the type of value.

Example

{{typeOf 1}}

{{typeOf "1"}}

{{typeOf "foo"}}

{{withHash}}

Block helper that builds the context for the block from the options hash.

Params

  • options {Object}: Handlebars provided options object.

Example

{{#withHash a=1 b="hello"}}
  {{a}} - {{b}}
{{/withHash}}