diff options
author | isaacs <i@izs.me> | 2010-05-13 01:46:51 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-05-13 01:46:51 +0400 |
commit | 58c119430c84dd8be2080fc561046cb1d556c671 (patch) | |
tree | 1b09e281ec99677610ad3c9c5a70bdb9bc463d1b /lib | |
parent | d3874b307dab9d018fc16948c5b33162628490b7 (diff) |
Make both name and version optional
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/registry.js | 9 |
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) } |