A tiny function for truncating a string that may contain ANSI escape sequences.
npm install --save ansi-truncate
import colors from 'tiny-colors';
import truncate from 'ansi-truncate';
truncate ( colors.red ( 'foo' ), 2 ); // => Same as: colors.red ( 'f…' );
MIT © Fabio Spampinato