Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix reading of default parameters in `npm owner`

Not `return`ing `readLocalPkg` caused callaback to be called more than
once.

Also add a default parameter to `npm owner ls` (current package).
  • Loading branch information...
commit 62075e84b9e666f73f2bcab2b915353ab4d37b44 1 parent 7cc468d
@mmalecki mmalecki authored isaacs committed
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/owner.js
View
12 lib/owner.js
@@ -80,7 +80,12 @@ function owner (args, cb) {
}
function ls (pkg, cb) {
- if (!pkg) return cb(owner.usage)
+ if (!pkg) return readLocalPkg(function (er, pkg) {
+ if (er) return cb(er)
+ if (!pkg) return cb(owner.usage)
+ ls(pkg, cb)
+ })
+
registry.get(pkg, function (er, data) {
var msg = ""
if (er) {
@@ -96,7 +101,8 @@ function ls (pkg, cb) {
}
function add (user, pkg, cb) {
- if (!pkg) readLocalPkg(function (er, pkg) {
+ if (!user) return cb(owner.usage)
+ if (!pkg) return readLocalPkg(function (er, pkg) {
if (er) return cb(er)
if (!pkg) return cb(new Error(owner.usage))
add(user, pkg, cb)
@@ -119,7 +125,7 @@ function add (user, pkg, cb) {
}
function rm (user, pkg, cb) {
- if (!pkg) readLocalPkg(function (er, pkg) {
+ if (!pkg) return readLocalPkg(function (er, pkg) {
if (er) return cb(er)
if (!pkg) return cb(new Error(owner.usage))
rm(user, pkg, cb)
Please sign in to comment.
Something went wrong with that request. Please try again.