2021-09-13 20:41:05 +00:00
|
|
|
export default function (query) {
|
|
|
|
return (/^[?#]/.test(query) ? query.slice(1) : query).split('&').reduce((params, param) => {
|
|
|
|
const [key, value] = param.split('=');
|
|
|
|
params[key] = value ? decodeURIComponent(value.replace(/\+/g, ' ')) : '';
|
|
|
|
return params;
|
|
|
|
}, {});
|
2018-05-07 20:43:26 +00:00
|
|
|
}
|