Skip to content

Commit bc33d58

Browse files
authored
decoding and indentation adjastement
1 parent 18b106c commit bc33d58

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Sprint-2/implement/querystring.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ function parseQueryString(queryString) {
33
const queryParams = {};
44
if (!queryString ) return queryParams;
55

6-
const keyValuePairs = queryString.split("&");
6+
const keyValuePairs = queryString.split("&");
77

8-
for (const pair of keyValuePairs) {
9-
const index = pair.indexOf("=");
10-
if (index === -1) {
8+
for (const pair of keyValuePairs) {
9+
const index = pair.indexOf("=");
10+
if (index === -1) {
1111
queryParams[decodeURIComponent(pair)] = undefined
12-
} else {
13-
const key = pair.slice(0, index);
14-
const value = pair.slice (index + 1);
12+
} else {
13+
const key = decodeURIComponent (pair.slice(0, index));
14+
const value = decodeURIComponent (pair.slice (index + 1));
1515
queryParams[key] = value;
16-
}
17-
return queryParams;
16+
}
17+
18+
return queryParams;
1819

19-
}
20+
}
2021
}
2122

2223
module.exports = parseQueryString;

0 commit comments

Comments
 (0)