diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-02-03 14:58:04 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-02-03 14:58:04 -1000 |
commit | da132772a40f9291abbc5fd997591e32d9f65268 (patch) | |
tree | f86be0097dd74ad8e1a240a7324da1f63a7e6745 /lib/util.js | |
parent | 72e77600465d68edfe3b23abc3509ed1a76a11e4 (diff) | |
download | patchfoo-da132772a40f9291abbc5fd997591e32d9f65268.tar.gz patchfoo-da132772a40f9291abbc5fd997591e32d9f65268.zip |
Move truncate function into utils
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 5 |
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 +} |