Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 30 lines (19 sloc) 0.899 kb

trunky - Basic truncation and string tools

build status

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

Something went wrong with that request. Please try again.