Skip to content

serby/trunky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trunky - Basic truncation and string tools

build status

This package is no longer maintained, use ellipsize

Installation

npm install trunky

Usage

var truncate = require('trunky').truncateWithEllipsis;

truncate('Hello world', 8); // Hello…
truncate('<b>Hello</b> world', 8); // Hello…

Note: the unicode character (\u2026) is used by default. If your application does not support unicode or you would prefer a different ellipsis character, truncate() takes an optional third argument which is the string to use:

truncate('Hello world', 8, '...'); // Hello...
truncate('Hello world', 8, ' etc.'); // Hello etc.

Credits

Paul Serby follow me on twitter

Licence

Licenced under the New BSD License

About

Basic truncation and string tools

Resources

Stars

Watchers

Forks

Packages

No packages published