Skip to content

truncateText()

@blobs/sdk v0.1.0


@blobs/sdk / utils/blobUtils / truncateText

truncateText(text, maxLength): string

Defined in: utils/blobUtils.ts:357

Truncate a string, appending an ellipsis if it was clipped.

Parameters

text

string

Source string.

maxLength

number

Maximum total length of the result, including the ellipsis.

Returns

string

The original string if it’s already short enough, otherwise a clipped version ending in ....