Skip to content

A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.

License

Notifications You must be signed in to change notification settings

fabiospampinato/tiny-truncate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A tiny function for truncating a string which may containg ANSI escapes, with automatic terminal width detection.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published