/usr/lib/nodejs/url-to-options/index.js is in node-url-to-options 1.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 'use strict';
// Copied from https://github.com/nodejs/node/blob/master/lib/internal/url.js
function urlToOptions(url) {
var options = {
protocol: url.protocol,
hostname: url.hostname,
hash: url.hash,
search: url.search,
pathname: url.pathname,
path: `${url.pathname}${url.search}`,
href: url.href
};
if (url.port !== '') {
options.port = Number(url.port);
}
if (url.username || url.password) {
options.auth = `${url.username}:${url.password}`;
}
return options;
}
module.exports = urlToOptions;
|