diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-11-23 12:04:03 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-11-23 12:04:03 +0000 |
commit | 45631562565760add7a7c52a6137e891f3a0c8f4 (patch) | |
tree | 44915f7c46d05fb8c6197662a3341ea8fb610f06 /app/assets/javascripts/lib/utils/common_utils.js | |
parent | 1d8ab59ebfa0d57e4015665c470c8339cd258a2c (diff) | |
download | gitlab-ce-45631562565760add7a7c52a6137e891f3a0c8f4.tar.gz |
Improve environments performance
Diffstat (limited to 'app/assets/javascripts/lib/utils/common_utils.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 195e2ca6a78..6fa1e84c170 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -270,46 +270,6 @@ export const parseIntPagination = paginationInformation => ({ }); /** - * Updates the search parameter of a URL given the parameter and value provided. - * - * If no search params are present we'll add it. - * If param for page is already present, we'll update it - * If there are params but not for the given one, we'll add it at the end. - * Returns the new search parameters. - * - * @param {String} param - * @param {Number|String|Undefined|Null} value - * @return {String} - */ -export const setParamInURL = (param, value) => { - let search; - const locationSearch = window.location.search; - - if (locationSearch.length) { - const parameters = locationSearch.substring(1, locationSearch.length) - .split('&') - .reduce((acc, element) => { - const val = element.split('='); - // eslint-disable-next-line no-param-reassign - acc[val[0]] = decodeURIComponent(val[1]); - return acc; - }, {}); - - parameters[param] = value; - - const toString = Object.keys(parameters) - .map(val => `${val}=${encodeURIComponent(parameters[val])}`) - .join('&'); - - search = `?${toString}`; - } else { - search = `?${param}=${value}`; - } - - return search; -}; - -/** * Given a string of query parameters creates an object. * * @example |