npm-registry-client
Advanced tools
Comparing version 0.0.9 to 0.0.10
22
index.js
@@ -23,9 +23,15 @@ | ||
function RegClient (options) { | ||
// a registry url must be provided. | ||
var registry = url.parse(options.registry) | ||
if (!registry.protocol) throw new Error( | ||
'Invalid registry: ' + registry.url) | ||
this.registry = registry.href | ||
if (this.registry.slice(-1) !== '/') { | ||
this.registry += '/' | ||
// if provided, then the registry needs to be a url. | ||
// if it's not provided, then we're just using the cache only. | ||
var registry = options.registry | ||
if (registry) { | ||
registry = url.parse(registry) | ||
if (!registry.protocol) throw new Error( | ||
'Invalid registry: ' + registry.url) | ||
this.registry = registry.href | ||
if (this.registry.slice(-1) !== '/') { | ||
this.registry += '/' | ||
} | ||
} else { | ||
this.registry = null | ||
} | ||
@@ -60,3 +66,3 @@ | ||
if (this.auth && !this.alwaysAuth) { | ||
if (this.auth && !this.alwaysAuth && this.registry) { | ||
// if we're always authing, then we just send the | ||
@@ -63,0 +69,0 @@ // user/pass on every thing. otherwise, create a |
@@ -18,2 +18,4 @@ | ||
if (!this.registry) timeout = Infinity | ||
if ( process.env.COMP_CWORD !== undefined | ||
@@ -20,0 +22,0 @@ && process.env.COMP_LINE !== undefined |
@@ -16,2 +16,5 @@ module.exports = regRequest | ||
if (!this.registry) return cb(new Error( | ||
"No registry url provided: " + method + " " + where)) | ||
// Since there are multiple places where an error could occur, | ||
@@ -18,0 +21,0 @@ // don't let the cb be called more than once. |
@@ -5,3 +5,3 @@ { | ||
"description": "Client for the npm registry", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "git://github.com/isaacs/npm-registry-client" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65517
1011