Skip to content

securingsincity/node-truncate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Truncate Build Status Gittip

Truncate text and keeps urls safe.

NPM

Install the module with: npm install truncate

Usage

// Browser
String.truncate("1234 http://google.com hey :)", 2) === "12..."
// NodeJS
> truncate = require('truncate');
> truncate("1234 http://google.com hey :)", 4);
"1234..."
> truncate("1234 http://google.com hey :)", 4, {ellipsis:null}); // or ellipsis:''
"1234"
> truncate("1234 http://google.com hey :)", 6);
"1234 http://google.com..."
> truncate("1234 http://google.com hey :)", 100);
"1234 http://google.com hey :)"

Release History

v1.0.0 - Initial commit (5 apr. 2012)

Donate

Donate Bitcoins

License

Copyright (c) 2013 Francois-Guillaume Ribreau Licensed under the MIT license.

About

Truncate text and keeps urls safe.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%