mirror of
https://github.com/nodejs/node.git
synced 2025-05-17 02:30:33 +00:00

PR-URL: https://github.com/iojs/io.js/pull/266 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
24 lines
470 B
JavaScript
24 lines
470 B
JavaScript
var url = require("url")
|
|
|
|
module.exports = toNerfDart
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
function toNerfDart(uri) {
|
|
var parsed = url.parse(uri)
|
|
delete parsed.protocol
|
|
delete parsed.auth
|
|
delete parsed.query
|
|
delete parsed.search
|
|
delete parsed.hash
|
|
|
|
return url.resolve(url.format(parsed), ".")
|
|
}
|