trunky

0.2.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    23
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    23
  • 0.1.0
    0
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i trunky

Weekly Downloads

23

Version

0.2.0

License

none

Last publish

Collaborators

  • serby