Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

iHub cloud used https://handlebarsjs.com/ as template language.

This is an extension to Mustache and have few smart functions.

Smart functions

{{{toCSV list 'propertyName' 'quotes'}}}

Creates a csv of the array.
example{{{toCSV list 'name' '\"'}}} would take an array of object and use the name property with double quotes to create a csv, like this "Peter","Rickard"

{{toJSON object}} or {{JSONstringify object}}

Runs JSON.stringify(object) on the object.
Good to use in cases where you get an output like [object Object],[object Object]

example and object like this {payload:[{ value: "foo" },{ value: "bar" }]} with the mustache {{{toJSON payload}}} would resolve in [{"value":"foo"},{"value":"bar"}] instead of [object Object],[object Object]

See all Math functions

"{{#eq 1 1}}YES{{/eq}}" tests if 1 eq 1 and return YES

{{add 1 1}} results in 2

See all Dates functions

Moment date functions

{{date "5 years ago" "YYYY"}} resolves current year - 5

{{moment format="HH:mm:ss"}} 16:34:56

See all helpers

Handlebars is extended with all the helpers in the link

  • No labels