1 |
|
2 |
|
3 |
|
4 | var QueryParams = (function () {
|
5 | function QueryParams() {
|
6 | this.data = {};
|
7 | }
|
8 | QueryParams.prototype.parseUrl = function (url) {
|
9 | if (url) {
|
10 | var startIndex = url.indexOf('?');
|
11 | if (startIndex > -1) {
|
12 | var queries = url.slice(startIndex + 1).split('&');
|
13 | for (var i = 0; i < queries.length; i++) {
|
14 | if (queries[i].indexOf('=') > 0) {
|
15 | var split = queries[i].split('=');
|
16 | if (split.length > 1) {
|
17 | this.data[split[0].toLowerCase()] = split[1].split('#')[0];
|
18 | }
|
19 | }
|
20 | }
|
21 | }
|
22 | }
|
23 | };
|
24 | QueryParams.prototype.get = function (key) {
|
25 | return this.data[key.toLowerCase()];
|
26 | };
|
27 | return QueryParams;
|
28 | }());
|
29 | export { QueryParams };
|
30 |
|
\ | No newline at end of file |