UNPKG

fast-string-truncated-width

Version:

A fast function for calculating where a string should be truncated, given an optional width limit and an ellipsis string.

20 lines (19 loc) 413 B
type TruncationOptions = { limit?: number; ellipsis?: string; ellipsisWidth?: number; }; type WidthOptions = { controlWidth?: number; tabWidth?: number; emojiWidth?: number; regularWidth?: number; wideWidth?: number; }; type Result = { width: number; index: number; truncated: boolean; ellipsed: boolean; }; export type { TruncationOptions, WidthOptions, Result };