• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1const { URL } = require('url')
2
3/**
4 * Maps a URL to an identifier.
5 *
6 * Name courtesy schiffertronix media LLC, a New Jersey corporation
7 *
8 * @param {String} uri The URL to be nerfed.
9 *
10 * @returns {String} A nerfed URL.
11 */
12module.exports = (url) => {
13  const parsed = new URL(url)
14  const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}`
15  const rel = new URL('.', from)
16  const res = `//${rel.host}${rel.pathname}`
17  return res
18}
19