|
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- /**
- * URL utility.
- */
- class XMLHttpRequestURLUtility {
- /**
- * Returns "true" if SSL.
- *
- * @param url URL.
- * @returns "true" if SSL.
- */
- static isSSL(url) {
- return url.protocol === 'https:';
- }
- /**
- * Returns "true" if SSL.
- *
- * @param url URL.
- * @returns "true" if SSL.
- */
- static isLocal(url) {
- return url.protocol === 'file:';
- }
- /**
- * Returns "true" if protocol is valid.
- *
- * @param url URL.
- * @returns "true" if valid.
- */
- static isSupportedProtocol(url) {
- switch (url.protocol) {
- case 'https:':
- case 'http:':
- case 'file:':
- case undefined:
- case '':
- return true;
- }
- return false;
- }
- /**
- * Returns host.
- *
- * @param url URL.
- * @returns Host.
- */
- static getHost(url) {
- switch (url.protocol) {
- case 'http:':
- case 'https:':
- return url.hostname;
- case undefined:
- case '':
- return 'localhost';
- default:
- return null;
- }
- }
- }
- exports.default = XMLHttpRequestURLUtility;
- //# sourceMappingURL=XMLHttpRequestURLUtility.js.map
|