Skip to content

Commit

Permalink
A listing for npmTop
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jun 19, 2012
1 parent 4e8c087 commit 8102b12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions registry/rewrites.js
Expand Up @@ -34,6 +34,11 @@ module.exports =
, to:"../../../_users/_design/_auth/_list/email/listAll"
, method: "GET" }

, { from: "/-/top"
, to:"_view/npmTop"
, query: { group_level: 1 }
, method: "GET" }

, { from: "/-/by-user/:user", to: "_list/byUser/byUser", method: "GET" }
, { from: "/-/starred-by-user/:user", to: "_list/byUser/starredByUser", method: "GET" }
, { from: "/-/starred-by-package/:user", to: "_list/byUser/starredByPackage", method: "GET" }
Expand Down
7 changes: 7 additions & 0 deletions registry/views.js
Expand Up @@ -177,6 +177,13 @@ views.byUser = { map : function (doc) {
})
}}

views.npmTop = { map: function (doc) {
if (!doc || !doc.maintainers) return
doc.maintainers.forEach(function (m) {
emit([m.name, doc._id], 1)
})
}, reduce: "_sum" }

views.fieldsInUse =
{ map : function (doc) {
if (!doc.versions || !doc["dist-tags"] || !doc["dist-tags"].latest) return
Expand Down

0 comments on commit 8102b12

Please sign in to comment.