Skip to content

Instantly share code, notes, and snippets.

@flopezluis
Created April 13, 2012 09:53
Show Gist options
  • Save flopezluis/2375487 to your computer and use it in GitHub Desktop.
Save flopezluis/2375487 to your computer and use it in GitHub Desktop.
truncate + suffix
var truncate = function(msg, len, suffix) {
var truncated = msg.substring(0, len);
if (msg.length > len) {
truncated += suffix;
}
return truncated;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment