From 80bec2457fe08b2f46ae60a0f9f4326df091ab51 Mon Sep 17 00:00:00 2001 From: Triangle717 Date: Fri, 8 Aug 2014 20:11:41 -0400 Subject: [PATCH 1/2] Fix outdated comments --- src/utils/StringUtils.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/StringUtils.js b/src/utils/StringUtils.js index 4b59316c66a..9e4a6a75be6 100644 --- a/src/utils/StringUtils.js +++ b/src/utils/StringUtils.js @@ -199,18 +199,18 @@ define(function (require, exports, module) { } /** - * Truncate strings to specified length. + * Truncate text to specified length. * @param {string} str Text to be truncated. - * @param {number} len Length to which text should be limited. - * @return {string} Returns truncated text only if it was changed. + * @param {number} len Length to which text should be truncated + * @return {string} Returns truncated text only if it was changed */ function truncate(str, len) { - // Truncate the description if it is too long + // Truncate text to specified length if (str.length > len) { str = str.substr(0, len); - // To prevent awkward addition of ellipsis, try to truncate - // at the end of the last whole word + // To prevent awkwardly truncating in the middle of a word, + // attempt to truncate at the end of the last whole word var lastSpaceChar = str.lastIndexOf(" "); if (lastSpaceChar < len && lastSpaceChar > -1) { str = str.substr(0, lastSpaceChar); From 65a1e629d3e2823e9a9888742a82dfa148e74f0f Mon Sep 17 00:00:00 2001 From: Triangle717 Date: Mon, 11 Aug 2014 18:57:13 -0400 Subject: [PATCH 2/2] JSDoc fix --- src/utils/StringUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/StringUtils.js b/src/utils/StringUtils.js index 9e4a6a75be6..0c91abe86be 100644 --- a/src/utils/StringUtils.js +++ b/src/utils/StringUtils.js @@ -202,7 +202,7 @@ define(function (require, exports, module) { * Truncate text to specified length. * @param {string} str Text to be truncated. * @param {number} len Length to which text should be truncated - * @return {string} Returns truncated text only if it was changed + * @return {?string} Returns truncated text only if it was changed */ function truncate(str, len) { // Truncate text to specified length