Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow sort by rating

  • Loading branch information...
commit e6b9187b86ce0abe0e004d793e033f5633359ce6 1 parent 773d9ed
@isaacs isaacs authored
Showing with 4 additions and 3 deletions.
  1. +2 −2 lib/search.js
  2. +2 −1  lib/utils/config-defs.js
View
4 lib/search.js
@@ -152,7 +152,7 @@ function prettify (data, args) {
? [" ", "NAME", "DESCRIPTION", "AUTHOR", "DATE", "KEYWORDS"]
: [" ", "NAME", "AUTHOR", "DATE", "KEYWORDS"]
, lines
- , searchsort = (npm.config.get("searchsort") || "NAME").toLowerCase()
+ , searchsort = (npm.config.get("searchsort") || "name").toLowerCase()
, sortFields = { rating: 0
, name: 1
, description: 2
@@ -276,7 +276,7 @@ function colorize (line) {
return line.split("\u0000").join("\033[0m")
}
-function getRating(dateString) {
+function getRating (dateString) {
// simple rating based on modified time
var aMonth = 1000 * 60 * 60 * 24 * 30 // a month (30 days) in milliseconds
var aYearAgo = new Date().getTime() - aMonth * 12
View
3  lib/utils/config-defs.js
@@ -272,7 +272,8 @@ exports.types =
, "description", "-description"
, "author", "-author"
, "date", "-date"
- , "keywords", "-keywords" ]
+ , "keywords", "-keywords"
+ , "rating", "-rating" ]
, shell : String
, "strict-ssl": Boolean
, tag : String
Please sign in to comment.
Something went wrong with that request. Please try again.