Handlebars Helpers
Various helper utilities for use in Handlebars templates.
Table of contents
Functions
Functions
add
▸ add(a
, b
): any
Adds two numbers.
Parameters
Name | Type |
---|---|
a | any |
b | any |
Returns
any
Example
<span>{{add 6 3}}</span>
Defined in
capitalize
▸ capitalize(a
): string
Capitalizes the first character of a string.
Parameters
Name | Type |
---|---|
a | any |
Returns
string
Example
<span>{{capitalize link.title}}</span>
Defined in
divide
▸ divide(a
, b
): number
Divides two numbers.
Parameters
Name | Type |
---|---|
a | any |
b | any |
Returns
number
Example
<span>{{divide 6 3}}</span>
Defined in
humanizeUnixTime
▸ humanizeUnixTime(a
): string
| false
Humanizes a Unix timestamp.
Parameters
Name | Type |
---|---|
a | any |
Returns
string
| false
Example
<span>{{humanizeUnixTime 1693766828}}</span>
Defined in
ifeq
▸ ifeq(a
, b
, options
): string
Performs a strict equality check between two items to conditionally render based on the result.
Parameters
Name | Type |
---|---|
a | any |
b | any |
options | HelperOptions |
Returns
string
Example
<span>
{{#ifeq 6 3}}
Equal
{{/ifeq}}
</span>
Example
<span>
{{#ifeq 6 3}}
Equal
{{else}}
Not equal
{{/ifeq}}
</span>
Defined in
ifnoteq
▸ ifnoteq(a
, b
, options
): string
Performs a strict inequality check between two items to conditionally render based on the result.
Parameters
Name | Type |
---|---|
a | any |
b | any |
options | HelperOptions |
Returns
string
Example
<span>
{{#ifnoteq 6 3}}
Not equal
{{/ifnoteq}}
</span>
Example
<span>
{{#ifnoteq 6 3}}
Not equal
{{else}}
Equal
{{/ifnoteq}}
</span>
Defined in
mod
▸ mod(a
, b
): number
Performs a modulo operation between two numbers.
Parameters
Name | Type |
---|---|
a | any |
b | any |
Returns
number
Example
<span>{{mod 6 3}}</span>
Defined in
multiply
▸ multiply(a
, b
): number
Multiplies two numbers.
Parameters
Name | Type |
---|---|
a | any |
b | any |
Returns
number
Example
<span>{{multiply 6 3}}</span>
Defined in
subtract
▸ subtract(a
, b
): number
Subtracts two numbers.
Parameters
Name | Type |
---|---|
a | any |
b | any |
Returns
number
Example
<span>{{subtract 6 3}}</span>
Defined in
timestampDate
▸ timestampDate(a
): string
Returns the date portion of a timestamp.
Parameters
Name | Type |
---|---|
a | any |
Returns
string
Example
<span>{{timestampDate "2023-09-03T14:53:21Z"}}</span>
Defined in
timestampTime
▸ timestampTime(a
): string
Returns the time portion of a timestamp.
Parameters
Name | Type |
---|---|
a | any |
Returns
string
Example
<span>{{timestampTime "2023-09-03T14:53:21Z"}}</span>