版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

62 строки
1.3 KiB

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. /**
  4. * URL utility.
  5. */
  6. class XMLHttpRequestURLUtility {
  7. /**
  8. * Returns "true" if SSL.
  9. *
  10. * @param url URL.
  11. * @returns "true" if SSL.
  12. */
  13. static isSSL(url) {
  14. return url.protocol === 'https:';
  15. }
  16. /**
  17. * Returns "true" if SSL.
  18. *
  19. * @param url URL.
  20. * @returns "true" if SSL.
  21. */
  22. static isLocal(url) {
  23. return url.protocol === 'file:';
  24. }
  25. /**
  26. * Returns "true" if protocol is valid.
  27. *
  28. * @param url URL.
  29. * @returns "true" if valid.
  30. */
  31. static isSupportedProtocol(url) {
  32. switch (url.protocol) {
  33. case 'https:':
  34. case 'http:':
  35. case 'file:':
  36. case undefined:
  37. case '':
  38. return true;
  39. }
  40. return false;
  41. }
  42. /**
  43. * Returns host.
  44. *
  45. * @param url URL.
  46. * @returns Host.
  47. */
  48. static getHost(url) {
  49. switch (url.protocol) {
  50. case 'http:':
  51. case 'https:':
  52. return url.hostname;
  53. case undefined:
  54. case '':
  55. return 'localhost';
  56. default:
  57. return null;
  58. }
  59. }
  60. }
  61. exports.default = XMLHttpRequestURLUtility;
  62. //# sourceMappingURL=XMLHttpRequestURLUtility.js.map