const resolveUrlQuery = function(url) {
let result = Object.create(null);
result.url = url;
if (!url) return result;
let sections = url.split('?');
if (sections.length === 2) {
result.baseUrl = sections[0] || '';
sections.splice(0, 1);
}
let segments = sections[0].split('&');
segments.forEach((seg) => {
if (!seg) return false;
let [key, value=''] = seg.split('=');
result[key] ? result[key] = [result[key], value] : result[key] = value
});
return result;
}
let url = 'http://localhost:8081/b2b/api/vendors/search?sort=lastModifiedTime%20desc&page=0&size=15&filter=&_t=1571364764447&name=jj&name=kk';
let result = resolveUrlQuery(url);
Object.keys(result).forEach((key) =>{
console.log(`key=${key}, value=${result[key]}`)
})
console