Make 'Form' render links and addresses correctly

This commit is contained in:
Alexis Sellier
2021-05-18 16:08:33 +02:00
parent f50ec8e614
commit 793f4327f2
3 changed files with 45 additions and 20 deletions
+12 -1
View File
@@ -36,7 +36,18 @@ export function isRadicleId(input: string): boolean {
return /^rad:[a-z]+:[a-zA-Z0-9]+$/.test(input);
}
// Check whether the input is a URL.
export function isUrl(input: string): boolean {
return /^https?:\/\//.test(input);
}
// Check whether the input is an Ethereum address.
export function isAddress(input: string): boolean {
return ethers.utils.isAddress(input);
}
// Get search parameters from location.
export function getSearchParam(key: string, location: RouteLocation): string | null {
let params = new URLSearchParams(location.search);
return params.get(key);
};
}