package
A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.
npm install tiny-truncateGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.
npm install tiny-truncateimport colors from 'tiny-colors';
import truncate from 'tiny-truncate';
// Let's truncate a string, spanning at most the entire width of the terminal
truncate ( colors.red ( '---'.repeat ( 1000 ) ) ); // Some red dashes that don't overflow the width of the terminalMIT © Fabio Spampinato
Estimated unpacked size across 3 packages.
18.8 kB
Includes dependencies.