1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.urlWithParams = exports.ParamsURL = exports.SearchURL = exports.SearchParamsURL = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | class SearchParamsURL extends URL {
|
9 | constructor(url, params, base) {
|
10 | super(url, base);
|
11 | const iterable = Array.isArray(params) || params instanceof URLSearchParams
|
12 | ? params
|
13 | : typeof params === 'string'
|
14 | ? new URLSearchParams(params)
|
15 | : Object.entries(params !== null && params !== void 0 ? params : {});
|
16 | for (const [k, v] of iterable)
|
17 | this.searchParams.append(k, '' + v);
|
18 | }
|
19 | }
|
20 | exports.SearchParamsURL = SearchParamsURL;
|
21 | exports.SearchURL = SearchParamsURL;
|
22 | exports.ParamsURL = SearchParamsURL;
|
23 |
|
24 | const urlWithParams = (...args) => {
|
25 | return new SearchParamsURL(...args).href;
|
26 | };
|
27 | exports.urlWithParams = urlWithParams;
|
28 |
|
\ | No newline at end of file |