tiny-truncate
v1.0.2
Published
A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.
Downloads
90,393
Readme
Tiny Truncate
A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.
Install
npm install --save tiny-truncate
Usage
import colors from 'tiny-colors';
import truncate from 'tiny-truncate';
truncate ( colors.red ( '---'.repeat ( 1000 ) ) ); // Some red dashes that don't overflow the width of the terminal
License
MIT © Fabio Spampinato