Function: truncate()
truncate(
this
,left
,length
,end
):string
Return a truncated version of the input string. The first argument, length,
defaults to 50
. The second argument defaults to an ellipsis (...
).
If the length of the input string is less than the given length (first
argument), the input string will be truncated to length
minus the length
of the second argument, with the second argument appended.
Parameters
• this: FilterContext
An object containing a reference to the active render context and any keyword/named arguments.
• left: unknown
Any value. Will be coerced to a string if it's not one already.
• length: unknown
= 50
Any value. If it can't be converted to a number, zero will
be used instead. Defaults to 50
.
• end: unknown
= "..."
Any value. Will be coerced to a string if it's not one already.
Defaults to ...
.
Returns
string
A truncated version of the input string.