Underscore string

Proxy filter for calling underscore string function

Parameters

string
Type: String
String to filter

fn
Type: String
Underscore function to call

params
Type: Parameters
Extra parameters to pass to Underscore string

Returns

Type: String
Formatted string

Example

{{ "this_Is_aTestFor_Underscore_string" | underscoreString: "humanize" }}

{{ "Truncating: lorem ipsum dolor sit amet, consectetur adipiscing elit." | underscoreString: "truncate": 42 }}

{{ "Pruning: lorem ipsum dolor sit amet, consectetur adipiscing elit." | underscoreString: "prune": 42: "... (show more)" }}

<p>{{ "this_Is_aTestFor_Underscore_string" | underscoreString: "humanize" }}</p>

Pluralize

Pluralizes the given string. It's a simple proxy to the pluralize function on util.

Parameters

string
Type: String
Noun to pluralize

count
Type: Integer
The numer of objects

includeCount
Type: Boolean
To include the number in formatted string

Returns

Type: String
Formatted plural

Example

Single
{{"person" | pluralize:1}}
Multiple
{{"person" | pluralize:1500}}
{{"person" | pluralize:1500}}

Timestamp filter

Takes in a unix timestamp and turns it into a human-readable relative time string, like "5
minutes ago" or "just now".

Parameters

time
Type: Unix timestamp
The time to format

Returns

Type: String
Formatted string

Example

Now - 5 minutes
{{ fiveMinAgo | timestamp }}
Now - 1 day
{{ oneDayAgo | timestamp }}
Now - 3 days
{{ threeDaysAgo | timestamp }}
{{ fiveMinAgo | timestamp }}

List

List filter. Use for converting arrays into a string

Parameters

list
Type: Array
Array of items

separator
Type: String
String to separate each element of the array (default ,)

Returns

Type: String
Formatted string

Example

{{ ["item1", "item2", "item3", "item4"] | list }}

{{ ["item1", "item2", "item3", "item4"] | list }}