Skip to content

TruncateOptions

TruncateOptions = object

Defined in: packages/core/src/string/truncate.ts:3

optional ellipsisString?: string

Defined in: packages/core/src/string/truncate.ts:16

The string to use as ellipsis. Default is “…”.


optional position?: "start" | "middle" | "end"

Defined in: packages/core/src/string/truncate.ts:5

Position to truncate the string. Default is “end”.


optional strictLength?: boolean

Defined in: packages/core/src/string/truncate.ts:23

If true, and maxLength is less than or equal to the length of ellipsisString, the function will return an empty string. If false, it will return the non-truncated ellipsisString. Default is true.


optional wordCutting?: boolean

Defined in: packages/core/src/string/truncate.ts:13

Whether to cut words when truncating. Default is true.

If false, the function will try to avoid cutting words by looking for spaces. If no suitable space is found, it will cut at the maximum length.