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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/logout.js')
-rw-r--r--lib/logout.js28
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/logout.js b/lib/logout.js
index 6fefc28a6..c1ac2818e 100644
--- a/lib/logout.js
+++ b/lib/logout.js
@@ -1,36 +1,34 @@
module.exports = logout
-var dezalgo = require("dezalgo")
-var log = require("npmlog")
+var dezalgo = require('dezalgo')
+var log = require('npmlog')
-var npm = require("./npm.js")
-var mapToRegistry = require("./utils/map-to-registry.js")
+var npm = require('./npm.js')
+var mapToRegistry = require('./utils/map-to-registry.js')
-logout.usage = "npm logout [--registry=<url>] [--scope=<@scope>]"
+logout.usage = 'npm logout [--registry=<url>] [--scope=<@scope>]'
function logout (args, cb) {
cb = dezalgo(cb)
- mapToRegistry("/", npm.config, function (err, uri, auth, normalized) {
+ mapToRegistry('/', npm.config, function (err, uri, auth, normalized) {
if (err) return cb(err)
if (auth.token) {
- log.verbose("logout", "clearing session token for", normalized)
+ log.verbose('logout', 'clearing session token for', normalized)
npm.registry.logout(normalized, { auth: auth }, function (err) {
if (err) return cb(err)
npm.config.clearCredentialsByURI(normalized)
- npm.config.save("user", cb)
+ npm.config.save('user', cb)
})
- }
- else if (auth.username || auth.password) {
- log.verbose("logout", "clearing user credentials for", normalized)
+ } else if (auth.username || auth.password) {
+ log.verbose('logout', 'clearing user credentials for', normalized)
npm.config.clearCredentialsByURI(normalized)
- npm.config.save("user", cb)
- }
- else {
+ npm.config.save('user', cb)
+ } else {
cb(new Error(
- "Not logged in to", normalized + ",", "so can't log out."
+ 'Not logged in to', normalized + ',', "so can't log out."
))
}
})