trouble-in-terror-town/node_modules/another-npm-registry-client/lib/stars.js
Mikolaj 2bbacbea09 did some more work on networking and removed EOS in favor of LRM
did some more work on networking and removed EOS in favor of Light Reflective Mirror
2022-05-31 15:04:31 +02:00

18 lines
651 B
JavaScript

module.exports = stars
var assert = require('assert')
var url = require('url')
function stars (uri, params, cb) {
assert(typeof uri === 'string', 'must pass registry URI to stars')
assert(params && typeof params === 'object', 'must pass params to stars')
assert(typeof cb === 'function', 'must pass callback to stars')
var auth = params.auth
var name = params.username || (auth && auth.username)
if (!name) return cb(new Error('must pass either username or auth to stars'))
var encoded = encodeURIComponent(name)
var path = '-/_view/starredByUser?key="' + encoded + '"'
this.request(url.resolve(uri, path), { auth: auth }, cb)
}