diff options
Diffstat (limited to 'app/assets/javascripts/lib/utils/url_utility.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/url_utility.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js index a9f6901de32..44d3e78b334 100644 --- a/app/assets/javascripts/lib/utils/url_utility.js +++ b/app/assets/javascripts/lib/utils/url_utility.js @@ -112,13 +112,13 @@ export function mergeUrlParams(params, url, options = {}) { const mergedKeys = sort ? Object.keys(merged).sort() : Object.keys(merged); const newQuery = mergedKeys - .filter(key => merged[key] !== null) - .map(key => { + .filter((key) => merged[key] !== null) + .map((key) => { let value = merged[key]; const encodedKey = encodeURIComponent(key); if (spreadArrays && Array.isArray(value)) { value = merged[key] - .map(arrayValue => encodeURIComponent(arrayValue)) + .map((arrayValue) => encodeURIComponent(arrayValue)) .join(`&${encodedKey}[]=`); return `${encodedKey}[]=${value}`; } @@ -150,11 +150,11 @@ export function removeParams(params, url = window.location.href, skipEncoding = return url; } - const removableParams = skipEncoding ? params : params.map(param => encodeURIComponent(param)); + const removableParams = skipEncoding ? params : params.map((param) => encodeURIComponent(param)); const updatedQuery = query .split('&') - .filter(paramPair => { + .filter((paramPair) => { const [foundParam] = paramPair.split('='); return removableParams.indexOf(foundParam) < 0; }) @@ -237,7 +237,7 @@ export function redirectTo(url) { return window.location.assign(url); } -export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); +export const escapeFileUrl = (fileUrl) => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); export function webIDEUrl(route = undefined) { let returnUrl = `${gon.relative_url_root || ''}/-/ide/`; @@ -396,7 +396,7 @@ export function queryToObject(query, options = {}) { */ export function objectToQuery(obj) { return Object.keys(obj) - .map(k => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`) + .map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`) .join('&'); } @@ -420,7 +420,7 @@ export const setUrlParams = ( const queryString = urlObj.search; const searchParams = clearParams ? new URLSearchParams('') : new URLSearchParams(queryString); - Object.keys(params).forEach(key => { + Object.keys(params).forEach((key) => { if (params[key] === null || params[key] === undefined) { searchParams.delete(key); } else if (Array.isArray(params[key])) { |