Nodejs String Shorten shorten(max_length)

Here you can find the source of shorten(max_length)

Method Source Code

String.prototype.shorten = function(max_length) {
    // TODO use max_length
    return this.replace(/^(.{15}[^\s]*).*/, "$1");
}

Related

  1. shorten(length)
    String.prototype.shorten = function(length){
        if(this.length <= length)
            return this;
        return this.substring(0,length - 3) + '...';