"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm-registry-client/lib/stars.js" (8 Mar 2017, 651 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 = stars
    2 
    3 var assert = require('assert')
    4 var url = require('url')
    5 
    6 function stars (uri, params, cb) {
    7   assert(typeof uri === 'string', 'must pass registry URI to stars')
    8   assert(params && typeof params === 'object', 'must pass params to stars')
    9   assert(typeof cb === 'function', 'must pass callback to stars')
   10 
   11   var auth = params.auth
   12   var name = params.username || (auth && auth.username)
   13   if (!name) return cb(new Error('must pass either username or auth to stars'))
   14   var encoded = encodeURIComponent(name)
   15   var path = '-/_view/starredByUser?key="' + encoded + '"'
   16 
   17   this.request(url.resolve(uri, path), { auth: auth }, cb)
   18 }