3 stars.usage = "npm stars [username]"
5 var npm = require("./npm.js")
6 , log = require("npmlog")
7 , mapToRegistry = require("./utils/map-to-registry.js")
9 function stars (args, cb) {
10 npm.commands.whoami([], true, function (er, username) {
11 var name = args.length === 1 ? args[0] : username
14 if (er.code === 'ENEEDAUTH' && !name) {
15 var needAuth = new Error("'npm stars' on your own user account requires auth")
16 needAuth.code = 'ENEEDAUTH'
20 if (er.code !== 'ENEEDAUTH') return cb(er)
23 mapToRegistry("", npm.config, function (er, uri, auth) {
30 npm.registry.stars(uri, params, showstars)
34 function showstars (er, data) {
37 if (data.rows.length === 0) {
38 log.warn("stars", "user has not starred any packages.")
40 data.rows.forEach(function(a) {