Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / shared / truncate-text.js
blobfc3388fb3349312d929f22062f919e0279f41571
1 'use strict';
3 // Truncates inputText to the desired length and adds ellipsis if the text is overflowing
4 // Ellipsis are inclusive to the desired length
5 function truncateText(inputText = '', length) {
6 if (inputText.length > length) {
7 return inputText.substring(0, length - 3) + '...';
10 return inputText;
13 module.exports = truncateText;