From da132772a40f9291abbc5fd997591e32d9f65268 Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 3 Feb 2019 14:58:04 -1000 Subject: Move truncate function into utils --- lib/util.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/util.js') 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 +} -- cgit v1.2.3