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.

readme.md 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # url-parse-lax [![Build Status](https://travis-ci.org/sindresorhus/url-parse-lax.svg?branch=master)](https://travis-ci.org/sindresorhus/url-parse-lax)
  2. > Lax [`url.parse()`](https://nodejs.org/docs/latest/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost) with support for protocol-less URLs & IPs
  3. ## Install
  4. ```
  5. $ npm install url-parse-lax
  6. ```
  7. ## Usage
  8. ```js
  9. const urlParseLax = require('url-parse-lax');
  10. urlParseLax('sindresorhus.com');
  11. /*
  12. {
  13. protocol: 'https:',
  14. slashes: true,
  15. auth: null,
  16. host: 'sindresorhus.com',
  17. port: null,
  18. hostname: 'sindresorhus.com',
  19. hash: null,
  20. search: null,
  21. query: null,
  22. pathname: '/',
  23. path: '/',
  24. href: 'https://sindresorhus.com/'
  25. }
  26. */
  27. urlParseLax('[2001:db8::]:8000');
  28. /*
  29. {
  30. protocol: null,
  31. slashes: true,
  32. auth: null,
  33. host: '[2001:db8::]:8000',
  34. port: '8000',
  35. hostname: '2001:db8::',
  36. hash: null,
  37. search: null,
  38. query: null,
  39. pathname: '/',
  40. path: '/',
  41. href: 'http://[2001:db8::]:8000/'
  42. }
  43. */
  44. ```
  45. And with the built-in `url.parse()`:
  46. ```js
  47. const url = require('url');
  48. url.parse('sindresorhus.com');
  49. /*
  50. {
  51. protocol: null,
  52. slashes: null,
  53. auth: null,
  54. host: null,
  55. port: null,
  56. hostname: null,
  57. hash: null,
  58. search: null,
  59. query: null,
  60. pathname: 'sindresorhus',
  61. path: 'sindresorhus',
  62. href: 'sindresorhus'
  63. }
  64. */
  65. url.parse('[2001:db8::]:8000');
  66. /*
  67. {
  68. protocol: null,
  69. slashes: null,
  70. auth: null,
  71. host: null,
  72. port: null,
  73. hostname: null,
  74. hash: null,
  75. search: null,
  76. query: null,
  77. pathname: '[2001:db8::]:8000',
  78. path: '[2001:db8::]:8000',
  79. href: '[2001:db8::]:8000'
  80. }
  81. */
  82. ```
  83. ## API
  84. ### urlParseLax(url, [options])
  85. #### url
  86. Type: `string`
  87. URL to parse.
  88. #### options
  89. Type: `Object`
  90. ##### https
  91. Type: `boolean`<br>
  92. Default: `true`
  93. Prepend `https://` instead of `http://` to protocol-less URLs.
  94. ## Related
  95. - [url-format-lax](https://github.com/sindresorhus/url-format-lax) - Lax `url.format()` that formats a hostname and port into IPv6-compatible socket form of `hostname:port`
  96. ## License
  97. MIT © [Sindre Sorhus](https://sindresorhus.com)