Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

url-to-options.js 722B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. /* istanbul ignore file: https://github.com/nodejs/node/blob/a91293d4d9ab403046ab5eb022332e4e3d249bd3/lib/internal/url.js#L1257 */
  3. module.exports = url => {
  4. const options = {
  5. protocol: url.protocol,
  6. hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname,
  7. host: url.host,
  8. hash: url.hash,
  9. search: url.search,
  10. pathname: url.pathname,
  11. href: url.href,
  12. path: `${url.pathname || ''}${url.search || ''}`
  13. };
  14. if (typeof url.port === 'string' && url.port.length !== 0) {
  15. options.port = Number(url.port);
  16. }
  17. if (url.username || url.password) {
  18. options.auth = `${url.username || ''}:${url.password || ''}`;
  19. }
  20. return options;
  21. };