aboutsummaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js
index 5bd5f11..4fdbc24 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -261,3 +261,8 @@ u.estimateMessageSize = function (content) {
return JSON.stringify(draftMsg, null, 2).length
}
+
+u.truncate = function (str, len) {
+ str = String(str)
+ return str.length > len ? str.substr(0, len) + '...' : str
+}