fix(util) fix parsing strings in parseURLParams
After https://github.com/jitsi/jitsi-meet/pull/11607 we might call it with a string. Be nice and accept that in addition to URL objects.
This commit is contained in:
parent
4d8f29d4fe
commit
2c5b132483
|
@ -23,9 +23,13 @@ const blacklist = [ '__proto__', 'constructor', 'prototype' ];
|
|||
* @returns {Object}
|
||||
*/
|
||||
export function parseURLParams(
|
||||
url: URL,
|
||||
url: URL | string,
|
||||
dontParse: boolean = false,
|
||||
source: string = 'hash'): Object {
|
||||
if (typeof url === 'string') {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = new URL(url);
|
||||
}
|
||||
const paramStr = source === 'search' ? url.search : url.hash;
|
||||
const params = {};
|
||||
const paramParts = (paramStr && paramStr.substr(1).split('&')) || [];
|
||||
|
|
Loading…
Reference in New Issue