node/deps/npm/node_modules/@npmcli/config/lib/nerf-dart.js
npm CLI robot abb46cfbc3
deps: upgrade npm to 10.5.2
PR-URL: https://github.com/nodejs/node/pull/52458
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2024-04-12 01:24:57 +00:00

18 lines
455 B
JavaScript

const { URL } = require('node: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
}