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.

index.js 387B

123456789101112131415
  1. 'use strict';
  2. module.exports = (url, opts) => {
  3. if (typeof url !== 'string') {
  4. throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof url}\``);
  5. }
  6. url = url.trim();
  7. opts = Object.assign({https: false}, opts);
  8. if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
  9. return url;
  10. }
  11. return url.replace(/^(?!(?:\w+:)?\/\/)/, opts.https ? 'https://' : 'http://');
  12. };