expensify-common
Advanced tools
Comparing version 2.0.102 to 2.0.103
@@ -506,5 +506,6 @@ /** | ||
* @param url The URL to be formatted | ||
* @param defaultScheme The Scheme to use in the URL | ||
* @returns The formatted URL | ||
*/ | ||
sanitizeURL(url: string): string; | ||
sanitizeURL(url: string, defaultScheme?: string): string; | ||
/** | ||
@@ -511,0 +512,0 @@ * Checks if parameter is a string or function |
@@ -893,5 +893,6 @@ "use strict"; | ||
* @param url The URL to be formatted | ||
* @param defaultScheme The Scheme to use in the URL | ||
* @returns The formatted URL | ||
*/ | ||
sanitizeURL(url) { | ||
sanitizeURL(url, defaultScheme = 'https') { | ||
const regex = new RegExp(`^${UrlPatterns.URL_REGEX}$`, 'i'); | ||
@@ -902,3 +903,3 @@ const match = regex.exec(url); | ||
} | ||
const website = match[3] ? match[2] : `https://${match[2]}`; | ||
const website = match[3] ? match[2] : `${defaultScheme}://${match[2]}`; | ||
return website.toLowerCase() + this.cutBefore(match[1], match[2]); | ||
@@ -905,0 +906,0 @@ }, |
{ | ||
"name": "expensify-common", | ||
"version": "2.0.102", | ||
"version": "2.0.103", | ||
"author": "Expensify, Inc.", | ||
@@ -5,0 +5,0 @@ "description": "Expensify libraries and components shared across different repos", |
506466
11316