// before exportconst toJSON = (str) => { let obj = {} str.substr(1).split('&').forEach(item => { let kv = item.split('=') if (kv && kv.length) { obj[kv[0]] = kv[1] } }) return obj }
// after exportconst toJSON = (str) => { let obj = {} let url = new URL(str) for (let [key, value] of url.searchParams.entries()) { obj[key] = value } return obj }