Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-05-13 01:46:51 +0400
committerisaacs <i@izs.me>2010-05-13 01:46:51 +0400
commit58c119430c84dd8be2080fc561046cb1d556c671 (patch)
tree1b09e281ec99677610ad3c9c5a70bdb9bc463d1b /lib
parentd3874b307dab9d018fc16948c5b33162628490b7 (diff)
Make both name and version optional
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/registry.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/utils/registry.js b/lib/utils/registry.js
index 91a0147d5..b5f236ecc 100644
--- a/lib/utils/registry.js
+++ b/lib/utils/registry.js
@@ -19,8 +19,13 @@ var npm = require("../../npm")
, path = require("path")
function get (project, version, cb) {
- if (!cb && typeof version === "function") cb = version, version = null
- GET(project+"/"+(version || ""), cb)
+ if (!cb) cb = version, version = null
+ if (!cb) cb = project, project = null
+ if (!cb) throw new Error("No callback provided to registry.get")
+ var uri = []
+ uri.push(project || "")
+ if (version) uri.push(version)
+ GET(uri.join("/"), cb)
}
function tag (project, version, tag, cb) { PUT(project+"/"+tag, version, cb) }