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 588B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const is = require('@sindresorhus/is');
  3. module.exports = url => {
  4. const options = {
  5. protocol: url.protocol,
  6. hostname: url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname,
  7. hash: url.hash,
  8. search: url.search,
  9. pathname: url.pathname,
  10. href: url.href
  11. };
  12. if (is.string(url.port) && url.port.length > 0) {
  13. options.port = Number(url.port);
  14. }
  15. if (url.username || url.password) {
  16. options.auth = `${url.username}:${url.password}`;
  17. }
  18. options.path = is.null(url.search) ? url.pathname : `${url.pathname}${url.search}`;
  19. return options;
  20. };