diff options
Diffstat (limited to 'lib/render.js')
-rw-r--r-- | lib/render.js | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/render.js b/lib/render.js index b4ca804..0e2f95f 100644 --- a/lib/render.js +++ b/lib/render.js @@ -419,18 +419,13 @@ Render.prototype.getName = function (id, cb) { } } -function truncate(str, len) { - str = String(str) - return str.length > len ? str.substr(0, len) + '...' : str -} - Render.prototype.getNameLink = function (id, opts, cb) { if (!cb && typeof opts === 'function') cb = opts, opts = null var length = opts && opts.length || Infinity var self = this self.getName(id, function (err, name) { if (err) return cb(err) - cb(null, h('a', {href: self.toUrl(id)}, truncate(name, length))) + cb(null, h('a', {href: self.toUrl(id)}, u.truncate(name, length))) }) } |