Nodejs Utililty Methods String Shorten

List of utility methods to do String Shorten

Description

The list of methods to do String Shorten are organized into topic(s).

Method

shorten(length)
String.prototype.shorten = function(length){
    if(this.length <= length)
        return this;
    return this.substring(0,length - 3) + '...';
shorten(max_length)
String.prototype.shorten = function(max_length) {
    return this.replace(/^(.{15}[^\s]*).*/, "$1");