"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm-registry-client/lib/logout.js" (8 Mar 2017, 722 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = logout
    2 
    3 var assert = require('assert')
    4 var url = require('url')
    5 
    6 function logout (uri, params, cb) {
    7   assert(typeof uri === 'string', 'must pass registry URI to logout')
    8   assert(params && typeof params === 'object', 'must pass params to logout')
    9   assert(typeof cb === 'function', 'must pass callback to star')
   10 
   11   var auth = params.auth
   12   assert(auth && typeof auth === 'object', 'must pass auth to logout')
   13   assert(typeof auth.token === 'string', 'can only log out for token auth')
   14 
   15   uri = url.resolve(uri, '-/user/token/' + auth.token)
   16   var options = {
   17     method: 'DELETE',
   18     auth: auth
   19   }
   20 
   21   this.log.verbose('logout', 'invalidating session token for user')
   22   this.request(uri, options, cb)
   23 }