1 | "use strict";
|
2 | exports.__esModule = true;
|
3 | var qs_1 = require("qs");
|
4 | function handleQs(url, query) {
|
5 | var _a = url.split('?'), start = _a[0], part2 = _a[1];
|
6 | var qs = (part2 || '').split('#')[0];
|
7 | var end = part2 && part2.split('#').length > 1 ? '#' + part2.split('#')[1] : '';
|
8 | var baseQs = qs_1.parse(qs);
|
9 | for (var i in query) {
|
10 | baseQs[i] = query[i];
|
11 | }
|
12 | qs = qs_1.stringify(baseQs);
|
13 | if (qs !== '') {
|
14 | qs = '?' + qs;
|
15 | }
|
16 | return start + qs + end;
|
17 | }
|
18 | exports["default"] = handleQs;
|