]> gerrit.simantics Code Review - simantics/district.git/blobdiff - 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
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npm-registry-client/lib/stars.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npm-registry-client/lib/stars.js
new file mode 100644 (file)
index 0000000..ba47f2c
--- /dev/null
@@ -0,0 +1,18 @@
+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)
+}