URL filter functionality.
This commit is contained in:
15
lib/url.js
15
lib/url.js
@@ -13,3 +13,18 @@ export function getDomainName(str) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
export function getQueryString(params) {
|
||||
const map = Object.keys(params).reduce((arr, key) => {
|
||||
if (params[key] !== undefined) {
|
||||
return arr.concat(`${key}=${encodeURIComponent(params[key])}`);
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
|
||||
if (map.length) {
|
||||
return `?${map.join('&')}`;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user