> For the complete documentation index, see [llms.txt](https://canvacard.srgobi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://canvacard.srgobi.com/utils/truncatetext.utils.md).

# Truncate Text

### truncateText ⇒ `string`

Truncates text to a specified length and adds an ellipsis if necessary.

**Kind**: global variable\
**Returns**: `string` - The original or truncated text.

| Param      | Type      | Default | Description                                                                        |
| ---------- | --------- | ------- | ---------------------------------------------------------------------------------- |
| text       | `string`  |         | The text to be truncated.                                                          |
| \[limit]   | `number`  | `25`    | The maximum length of text before truncation (default is 25).                      |
| \[fromEnd] | `boolean` | `false` | If true, truncation will be performed from the end of the text (default is false). |
