text-ellipsis
v1.0.3
Published
Cut a string if too long
Downloads
13,279
Readme
text-ellipsis
Cut off a string if too long
Why
You always want to cut long strings.
Install
$ npm install --save text-ellipsis
Usage
var ellipsis = require('text-ellipsis');
var short = ellipsis('a very long text', 10);
console.log(short);
// "a very ..."
var short = ellipsis('a very long text', 10, { side: 'start' });
console.log(short);
// "...ng text"
var short = ellipsis('a very long text', 10, { ellipsis: ' END' });
console.log(short);
// "a very END"