npm.io
1.4.0 • Published 1 year ago

ansi-truncate

Licence
MIT
Version
1.4.0
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
2

ANSI Truncate

A tiny function for truncating a string that may contain ANSI escape sequences.

Install

npm install ansi-truncate

Usage

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…' );

License

MIT Fabio Spampinato

Keywords