tweb/src/helpers/string/parseUriParams.ts
Eduard Kuzmenko f746a661e7 more fixes
2022-11-18 13:43:52 +04:00

16 lines
438 B
TypeScript

/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
export default function parseUriParams(uri: string, splitted = uri.split('?')) {
const params: any = {};
if(!splitted[1]) return params;
splitted[1].split('&').forEach((item) => {
params[item.split('=')[0]] = decodeURIComponent(item.split('=')[1]);
});
return params;
}