Skip to main content

Handlebars Helpers

Various helper utilities for use in Handlebars templates.

Table of contents

Functions

Functions

add

add(a, b): any

Adds two numbers.

Parameters

NameType
aany
bany

Returns

any

Example

<span>{{add 6 3}}</span>

Defined in

sandbox/src/helpers.ts:21


capitalize

capitalize(a): string

Capitalizes the first character of a string.

Parameters

NameType
aany

Returns

string

Example

<span>{{capitalize link.title}}</span>

Defined in

sandbox/src/helpers.ts:123


divide

divide(a, b): number

Divides two numbers.

Parameters

NameType
aany
bany

Returns

number

Example

<span>{{divide 6 3}}</span>

Defined in

sandbox/src/helpers.ts:33


humanizeUnixTime

humanizeUnixTime(a): string | false

Humanizes a Unix timestamp.

Parameters

NameType
aany

Returns

string | false

Example

<span>{{humanizeUnixTime 1693766828}}</span>

Defined in

sandbox/src/helpers.ts:135


ifeq

ifeq(a, b, options): string

Performs a strict equality check between two items to conditionally render based on the result.

Parameters

NameType
aany
bany
optionsHelperOptions

Returns

string

Example

<span>
{{#ifeq 6 3}}
Equal
{{/ifeq}}
</span>

Example

<span>
{{#ifeq 6 3}}
Equal
{{else}}
Not equal
{{/ifeq}}
</span>

Defined in

sandbox/src/helpers.ts:84


ifnoteq

ifnoteq(a, b, options): string

Performs a strict inequality check between two items to conditionally render based on the result.

Parameters

NameType
aany
bany
optionsHelperOptions

Returns

string

Example

<span>
{{#ifnoteq 6 3}}
Not equal
{{/ifnoteq}}
</span>

Example

<span>
{{#ifnoteq 6 3}}
Not equal
{{else}}
Equal
{{/ifnoteq}}
</span>

Defined in

sandbox/src/helpers.ts:111


mod

mod(a, b): number

Performs a modulo operation between two numbers.

Parameters

NameType
aany
bany

Returns

number

Example

<span>{{mod 6 3}}</span>

Defined in

sandbox/src/helpers.ts:147


multiply

multiply(a, b): number

Multiplies two numbers.

Parameters

NameType
aany
bany

Returns

number

Example

<span>{{multiply 6 3}}</span>

Defined in

sandbox/src/helpers.ts:45


subtract

subtract(a, b): number

Subtracts two numbers.

Parameters

NameType
aany
bany

Returns

number

Example

<span>{{subtract 6 3}}</span>

Defined in

sandbox/src/helpers.ts:57


timestampDate

timestampDate(a): string

Returns the date portion of a timestamp.

Parameters

NameType
aany

Returns

string

Example

<span>{{timestampDate "2023-09-03T14:53:21Z"}}</span>

Defined in

sandbox/src/helpers.ts:159


timestampTime

timestampTime(a): string

Returns the time portion of a timestamp.

Parameters

NameType
aany

Returns

string

Example

<span>{{timestampTime "2023-09-03T14:53:21Z"}}</span>

Defined in

sandbox/src/helpers.ts:171