Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Режем строку для красивого вывода
- * @param text {string} Обрезаемый текст
- * @param count {number} Кол-во слов, по которое нужно порезать. По умолчанию 15.
- * @param ends {string} Конец строки. По умолчанию '...'
- * @returns {string}
- */
- function cutTextElipsis(text, count = 15, ends = '...') {
- return text.length > count * 6 ? text.split(' ', count).join(' ') + ends : text;
- }
Add Comment
Please, Sign In to add comment