$ gnpm install tiny-truncate
A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.
npm install --save tiny-truncate
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
MIT © Fabio Spampinato
Copyright 2013 - present © cnpmjs.org | Home |