Resolve "Protocol Parsing: BIP21/PayPro, bch-mnemonic, etc"
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user