@tempots/std

ellipsisMiddle() function

Same as ellipsis but puts the symbol in the middle of the string and not to the end.

Signature:

ellipsisMiddle: (s: string, maxlen?: number, symbol?: string) => string

Parameters

Parameter

Type

Description

s

string

The string to truncate.

maxlen

number

(Optional) The maximum length of the string.

symbol

string

(Optional) The symbol to replace the truncated characters with.

Returns: string

The truncated string.

Example

ellipsisMiddle('tempo is a nice library', 18) // returns 'tempo is … library'