]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npm-registry-client/lib/stars.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / npm-registry-client / lib / stars.js
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 }