@mcma/core
Advanced tools
Comparing version 0.14.2 to 0.14.3
declare function isValidUrl(url: string): boolean; | ||
export interface ParsedUrl { | ||
href: string; | ||
protocol: string; | ||
host: string; | ||
hostname: string; | ||
port: string; | ||
pathname: string; | ||
search: string; | ||
hash: string; | ||
} | ||
declare function parseUrl(href: string): ParsedUrl | null; | ||
declare function getTypeName(type: string | object | Function): string; | ||
@@ -10,2 +21,3 @@ declare function toBase64(text: string): string; | ||
isValidUrl: typeof isValidUrl; | ||
parseUrl: typeof parseUrl; | ||
getTypeName: typeof getTypeName; | ||
@@ -12,0 +24,0 @@ toBase64: typeof toBase64; |
@@ -14,2 +14,16 @@ "use strict"; | ||
} | ||
function parseUrl(href) { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
const match = href.match(/^(https?:)\/\/(([^:\/?#]*)(?::([0-9]+))?)([\/]?[^?#]*)(\?[^#]*|)(#.*|)$/); | ||
return match && { | ||
href: href !== null && href !== void 0 ? href : "", | ||
protocol: (_a = match[1]) !== null && _a !== void 0 ? _a : "", | ||
host: (_b = match[2]) !== null && _b !== void 0 ? _b : "", | ||
hostname: (_c = match[3]) !== null && _c !== void 0 ? _c : "", | ||
port: (_d = match[4]) !== null && _d !== void 0 ? _d : "", | ||
pathname: (_e = match[5]) !== null && _e !== void 0 ? _e : "", | ||
search: (_f = match[6]) !== null && _f !== void 0 ? _f : "", | ||
hash: (_g = match[7]) !== null && _g !== void 0 ? _g : "" | ||
}; | ||
} | ||
function getTypeName(type) { | ||
@@ -66,2 +80,3 @@ if (typeof type === "function") { | ||
isValidUrl, | ||
parseUrl, | ||
getTypeName, | ||
@@ -68,0 +83,0 @@ toBase64, |
{ | ||
"name": "@mcma/core", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"description": "Node module with type definitions and helper utils for the EBU MCMA framework", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52296
1319