Permalink
Browse files

Truncate description to maxLen to get neater npm search output

  • Loading branch information...
1 parent 57003ea commit 74286ac381c035c8e189710f601d60a53bad15fa @timoxley committed Mar 25, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/search.js
View
@@ -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))

0 comments on commit 74286ac

Please sign in to comment.