Skip to content

Commit

Permalink
Truncate description to maxLen to get neater npm search output
Browse files Browse the repository at this point in the history
  • Loading branch information
timoxley committed Mar 25, 2012
1 parent 57003ea commit 74286ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/search.js
Expand Up @@ -177,6 +177,11 @@ function prettify (data, args) {
, (data.keywords || []).join(" ")
]
l.forEach(function (s, i) {
// limit description to maxLen.
// Remember to change this when changing/reordering columns
if (s.length > maxLen[i] && i == 1) {
s = l[i] = s.substring(0, maxLen[i] - 1) + '>'
}
var len = s.length
longest[i] = Math.min(maxLen[i] || Infinity
,Math.max(longest[i] || 0, len))
Expand Down

0 comments on commit 74286ac

Please sign in to comment.