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 'workspaces/config/lib/nerf-dart.js')
-rw-r--r--workspaces/config/lib/nerf-dart.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/workspaces/config/lib/nerf-dart.js b/workspaces/config/lib/nerf-dart.js
new file mode 100644
index 000000000..d6ae4aa2a
--- /dev/null
+++ b/workspaces/config/lib/nerf-dart.js
@@ -0,0 +1,18 @@
+const { URL } = require('url')
+
+/**
+ * Maps a URL to an identifier.
+ *
+ * Name courtesy schiffertronix media LLC, a New Jersey corporation
+ *
+ * @param {String} uri The URL to be nerfed.
+ *
+ * @returns {String} A nerfed URL.
+ */
+module.exports = (url) => {
+ const parsed = new URL(url)
+ const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`
+ const rel = new URL('.', from)
+ const res = `//${rel.host}${rel.pathname}`
+ return res
+}