Resolve "Protocol Parsing: BIP21/PayPro, bch-mnemonic, etc"

This commit is contained in:
2025-07-29 03:36:12 +00:00
committed by Jim Hamill
parent bb326d5b3b
commit 46baf8702d
6 changed files with 584 additions and 7 deletions
+24
View File
@@ -15,3 +15,27 @@ export function getOutpointId(outpoint: {
export function generateActivityId() {
return Date.now().toString();
}
/**
* Checks if a URL has duplicate parameters.
*
* @param url - The URL to check
* @returns True if the URL has duplicate parameters, false otherwise
*/
export function hasDuplicateParams(url: string | URL): boolean {
if (typeof url === 'string') {
url = new URL(url);
}
const params = url.searchParams;
const seen = new Set<string>();
for (const [key] of params.entries()) {
if (seen.has(key)) {
return true;
}
seen.add(key);
}
return false;
}