Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5f938355
Commit
5f938355
authored
Aug 16, 2018
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify urlParamsToObject
parent
4b1b5b0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+10
-10
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
5f938355
...
...
@@ -152,19 +152,19 @@ export const urlParamsToObject = (path = '') => splitPath(path)
}
const
data
=
dataParam
;
const
paramSplit
=
filterParam
.
split
(
'
=
'
);
const
paramKeyNormalized
=
paramSplit
[
0
].
replace
(
'
[]
'
,
'
'
);
const
isArray
=
paramSplit
[
0
].
indexOf
(
'
[]
'
);
const
value
=
decodeURIComponent
(
paramSplit
[
1
]
.
replace
(
/
\+
/g
,
'
'
));
if
(
isArray
!==
-
1
)
{
if
(
!
data
[
paramKeyNormalized
])
{
data
[
paramKeyNormalized
]
=
[];
let
[
key
,
value
]
=
filterParam
.
split
(
'
=
'
);
const
isArray
=
key
.
includes
(
'
[]
'
);
key
=
key
.
replace
(
'
[]
'
,
'
'
);
value
=
decodeURIComponent
(
value
.
replace
(
/
\+
/g
,
'
'
));
if
(
isArray
)
{
if
(
!
data
[
key
])
{
data
[
key
]
=
[];
}
data
[
paramKeyNormalized
].
push
(
value
);
data
[
key
].
push
(
value
);
}
else
{
data
[
paramKeyNormalized
]
=
value
;
data
[
key
]
=
value
;
}
return
data
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment