Fix deadlock limitSymbols

This commit is contained in:
morethanwords 2021-03-04 22:52:46 +04:00
parent fa91e7aa37
commit 66f79bd558

View File

@ -3,8 +3,9 @@
} */ } */
export function limitSymbols(str: string, length: number, limitFrom = length + 10) { export function limitSymbols(str: string, length: number, limitFrom = length + 10) {
str = str.trim();
if(str.length > limitFrom) { if(str.length > limitFrom) {
str = str.slice(0, length).replace(/(\n|\s)+$/, '') + '...'; str = str.slice(0, length)/* .replace(/\s*$/, '') */ + '...';
} }
return str; return str;