This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function trim(message, maxLength) { | |
| var m = message; | |
| var maxLen = maxLength; | |
| //string is too long, lets trim it and append ... | |
| if (m.length > maxLen) { | |
| var lastSpace = m.lastIndexOf(' '); | |
| //there is no space in the word | |
| if (lastSpace === -1) { | |
| m = m.slice(0, maxLen-3); |