mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
trim spaces in stringwrap
This commit is contained in:
parent
0e05d556c1
commit
21fc43693b
1 changed files with 5 additions and 1 deletions
|
@ -32,7 +32,11 @@ module.exports.timestamp = function(time, flag = "t"){
|
|||
|
||||
module.exports.stringwrap = function(content = "", length, newlines = true){
|
||||
if(!newlines) content = content.replace(/\n/, ' ')
|
||||
if(content.length > length) return content.substr(0, length) + '...';
|
||||
if(content.length > length){
|
||||
c = content.substr(0, length) + '...';
|
||||
while(c.endsWith(' ...')) c = c.substr(0, c.length - 4) + '...';
|
||||
return c;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue