Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/pacote/lib/fetchers/registry/registry-key.js')
-rw-r--r--node_modules/pacote/lib/fetchers/registry/registry-key.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/node_modules/pacote/lib/fetchers/registry/registry-key.js b/node_modules/pacote/lib/fetchers/registry/registry-key.js
new file mode 100644
index 000000000..4df3e2382
--- /dev/null
+++ b/node_modules/pacote/lib/fetchers/registry/registry-key.js
@@ -0,0 +1,16 @@
+'use strict'
+
+const url = require('url')
+
+// Called a nerf dart in the main codebase. Used as a "safe"
+// key when fetching registry info from config.
+module.exports = registryKey
+function registryKey (registry) {
+ const parsed = url.parse(registry)
+ const formatted = url.format({
+ host: parsed.host,
+ path: parsed.path,
+ slashes: parsed.slashes
+ })
+ return url.resolve(formatted, '.')
+}