$ npm install ansi-truncate
A tiny function for truncating a string that may contain ANSI escape sequences.
npm install ansi-truncate
import colors from 'tiny-colors';
import truncate from 'ansi-truncate';
// Let's truncate a string to a visual width of 2
truncate ( colors.red ( 'foo' ), 2 ); // => Same as: colors.red ( 'f…' );
MIT © Fabio Spampinato
© 2010 - cnpmjs.org x YWFE | Home | YWFE