Commit fe829def authored by Simon Knox's avatar Simon Knox

fix lint

parent 3f016fe7
...@@ -132,21 +132,23 @@ export const parseUrlPathname = url => { ...@@ -132,21 +132,23 @@ export const parseUrlPathname = url => {
return parsedUrl.pathname.charAt(0) === '/' ? parsedUrl.pathname : `/${parsedUrl.pathname}`; return parsedUrl.pathname.charAt(0) === '/' ? parsedUrl.pathname : `/${parsedUrl.pathname}`;
}; };
export const urlParamsToArray = (path = '') => { function splitPath(path) {
return path return path
.slice(1) // Remove the first character of search as it is always ? .replace(/^\?/, '')
.split('&') .split('&');
}
export const urlParamsToArray = (path = '') => splitPath(path)
.filter(param => param.length > 0) .filter(param => param.length > 0)
.map(param => { .map(param => {
const split = param.split('='); const split = param.split('=');
return [decodeURI(split[0]), split[1]].join('='); return [decodeURI(split[0]), split[1]].join('=');
}); });
};
export const getUrlParamsArray = () => urlParamsToArray(window.location.search); export const getUrlParamsArray = () => urlParamsToArray(window.location.search);
export const urlParamsToObject = (path = '') => { export const urlParamsToObject = (path = '') => splitPath(path)
return path.split('&').reduce((dataParam, filterParam) => { .reduce((dataParam, filterParam) => {
if (filterParam === '') return dataParam; if (filterParam === '') return dataParam;
const data = dataParam; const data = dataParam;
...@@ -167,7 +169,6 @@ export const urlParamsToObject = (path = '') => { ...@@ -167,7 +169,6 @@ export const urlParamsToObject = (path = '') => {
return data; return data;
}, {}); }, {});
};
export const isMetaKey = e => e.metaKey || e.ctrlKey || e.altKey || e.shiftKey; export const isMetaKey = e => e.metaKey || e.ctrlKey || e.altKey || e.shiftKey;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment