Truncate a string to a desired terminal width while preserving ANSI escape codes,
Unicode surrogate pairs, and fullwidth characters.
Based on cli-truncate.
import{ truncate }from'@boost/terminal'; const text =truncate(aStringThatMayContainAnsi,10,{ position:'middle'});
Truncate a string to a desired terminal width while preserving ANSI escape codes, Unicode surrogate pairs, and fullwidth characters. Based on cli-truncate.