ctrl + k
On This Page
Functions
Numeric Helpers
Numeric helpers provide utilities for working with numbers in templates.
Functions
numberFromIndex
Returns the index plus one, useful for human-readable numbering.
Template Syntax
Parameters
Name | Type | Description |
---|---|---|
a | number | The index value |
Returns
number
- The index plus one.
Example
maybePlural
Adds a plural suffix if the value is not 1.
Template Syntax
Parameters
Name | Type | Default | Description |
---|---|---|---|
value | number | The count to check | |
plural | string | ’s’ | The plural suffix to add |
Returns
string
- The plural suffix if the value is not 1, otherwise an empty string.