@gjsify/querystring 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/esm/index.js CHANGED
@@ -1,1033 +1,1055 @@
1
- import { Buffer } from "node:buffer";
2
1
  import { NodeURIError } from "./error.js";
2
+ import { Buffer } from "node:buffer";
3
+
4
+ //#region src/index.ts
3
5
  const hexTable = new Array(256);
4
6
  for (let i = 0; i < 256; ++i) {
5
- hexTable[i] = "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
6
- }
7
- function encodeStr(str, noEscapeTable, hexTable2) {
8
- const len = str.length;
9
- if (len === 0) return "";
10
- let out = "";
11
- let lastPos = 0;
12
- for (let i = 0; i < len; i++) {
13
- let c = str.charCodeAt(i);
14
- if (c < 128) {
15
- if (noEscapeTable[c] === 1) continue;
16
- if (lastPos < i) out += str.slice(lastPos, i);
17
- lastPos = i + 1;
18
- out += hexTable2[c];
19
- continue;
20
- }
21
- if (lastPos < i) out += str.slice(lastPos, i);
22
- if (c < 2048) {
23
- lastPos = i + 1;
24
- out += hexTable2[192 | c >> 6] + hexTable2[128 | c & 63];
25
- continue;
26
- }
27
- if (c < 55296 || c >= 57344) {
28
- lastPos = i + 1;
29
- out += hexTable2[224 | c >> 12] + hexTable2[128 | c >> 6 & 63] + hexTable2[128 | c & 63];
30
- continue;
31
- }
32
- ++i;
33
- if (i >= len) throw new ERR_INVALID_URI();
34
- const c2 = str.charCodeAt(i) & 1023;
35
- lastPos = i + 1;
36
- c = 65536 + ((c & 1023) << 10 | c2);
37
- out += hexTable2[240 | c >> 18] + hexTable2[128 | c >> 12 & 63] + hexTable2[128 | c >> 6 & 63] + hexTable2[128 | c & 63];
38
- }
39
- if (lastPos === 0) return str;
40
- if (lastPos < len) return out + str.slice(lastPos);
41
- return out;
7
+ hexTable[i] = "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
42
8
  }
43
- class ERR_INVALID_URI extends NodeURIError {
44
- constructor() {
45
- super("ERR_INVALID_URI", `URI malformed`);
46
- }
9
+ function encodeStr(str, noEscapeTable, hexTable) {
10
+ const len = str.length;
11
+ if (len === 0) return "";
12
+ let out = "";
13
+ let lastPos = 0;
14
+ for (let i = 0; i < len; i++) {
15
+ let c = str.charCodeAt(i);
16
+ if (c < 128) {
17
+ if (noEscapeTable[c] === 1) continue;
18
+ if (lastPos < i) out += str.slice(lastPos, i);
19
+ lastPos = i + 1;
20
+ out += hexTable[c];
21
+ continue;
22
+ }
23
+ if (lastPos < i) out += str.slice(lastPos, i);
24
+ if (c < 2048) {
25
+ lastPos = i + 1;
26
+ out += hexTable[192 | c >> 6] + hexTable[128 | c & 63];
27
+ continue;
28
+ }
29
+ if (c < 55296 || c >= 57344) {
30
+ lastPos = i + 1;
31
+ out += hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
32
+ continue;
33
+ }
34
+ ++i;
35
+ if (i >= len) throw new ERR_INVALID_URI();
36
+ const c2 = str.charCodeAt(i) & 1023;
37
+ lastPos = i + 1;
38
+ c = 65536 + ((c & 1023) << 10 | c2);
39
+ out += hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
40
+ }
41
+ if (lastPos === 0) return str;
42
+ if (lastPos < len) return out + str.slice(lastPos);
43
+ return out;
47
44
  }
45
+ var ERR_INVALID_URI = class extends NodeURIError {
46
+ constructor() {
47
+ super("ERR_INVALID_URI", `URI malformed`);
48
+ }
49
+ };
50
+ /**
51
+ * Alias of querystring.parse()
52
+ * @legacy
53
+ */
48
54
  const decode = parse;
55
+ /**
56
+ * Alias of querystring.stringify()
57
+ * @legacy
58
+ */
49
59
  const encode = stringify;
60
+ /**
61
+ * replaces encodeURIComponent()
62
+ * @see https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4
63
+ */
50
64
  function qsEscape(str) {
51
- if (typeof str !== "string") {
52
- if (typeof str === "object") {
53
- str = String(str);
54
- } else {
55
- str += "";
56
- }
57
- }
58
- return encodeStr(str, noEscape, hexTable);
65
+ if (typeof str !== "string") {
66
+ if (typeof str === "object") {
67
+ str = String(str);
68
+ } else {
69
+ str += "";
70
+ }
71
+ }
72
+ return encodeStr(str, noEscape, hexTable);
59
73
  }
74
+ /**
75
+ * Performs URL percent-encoding on the given `str` in a manner that is optimized for the specific requirements of URL query strings.
76
+ * Used by `querystring.stringify()` and is generally not expected to be used directly.
77
+ * It is exported primarily to allow application code to provide a replacement percent-encoding implementation if necessary by assigning `querystring.escape` to an alternative function.
78
+ * @legacy
79
+ * @see Tested in `test-querystring-escape.js`
80
+ */
60
81
  const escape = qsEscape;
61
82
  const isHexTable = new Int8Array([
62
- 0,
63
- 0,
64
- 0,
65
- 0,
66
- 0,
67
- 0,
68
- 0,
69
- 0,
70
- 0,
71
- 0,
72
- 0,
73
- 0,
74
- 0,
75
- 0,
76
- 0,
77
- 0,
78
- // 0 - 15
79
- 0,
80
- 0,
81
- 0,
82
- 0,
83
- 0,
84
- 0,
85
- 0,
86
- 0,
87
- 0,
88
- 0,
89
- 0,
90
- 0,
91
- 0,
92
- 0,
93
- 0,
94
- 0,
95
- // 16 - 31
96
- 0,
97
- 0,
98
- 0,
99
- 0,
100
- 0,
101
- 0,
102
- 0,
103
- 0,
104
- 0,
105
- 0,
106
- 0,
107
- 0,
108
- 0,
109
- 0,
110
- 0,
111
- 0,
112
- // 32 - 47
113
- 1,
114
- 1,
115
- 1,
116
- 1,
117
- 1,
118
- 1,
119
- 1,
120
- 1,
121
- 1,
122
- 1,
123
- 0,
124
- 0,
125
- 0,
126
- 0,
127
- 0,
128
- 0,
129
- // 48 - 63
130
- 0,
131
- 1,
132
- 1,
133
- 1,
134
- 1,
135
- 1,
136
- 1,
137
- 0,
138
- 0,
139
- 0,
140
- 0,
141
- 0,
142
- 0,
143
- 0,
144
- 0,
145
- 0,
146
- // 64 - 79
147
- 0,
148
- 0,
149
- 0,
150
- 0,
151
- 0,
152
- 0,
153
- 0,
154
- 0,
155
- 0,
156
- 0,
157
- 0,
158
- 0,
159
- 0,
160
- 0,
161
- 0,
162
- 0,
163
- // 80 - 95
164
- 0,
165
- 1,
166
- 1,
167
- 1,
168
- 1,
169
- 1,
170
- 1,
171
- 0,
172
- 0,
173
- 0,
174
- 0,
175
- 0,
176
- 0,
177
- 0,
178
- 0,
179
- 0,
180
- // 96 - 111
181
- 0,
182
- 0,
183
- 0,
184
- 0,
185
- 0,
186
- 0,
187
- 0,
188
- 0,
189
- 0,
190
- 0,
191
- 0,
192
- 0,
193
- 0,
194
- 0,
195
- 0,
196
- 0,
197
- // 112 - 127
198
- 0,
199
- 0,
200
- 0,
201
- 0,
202
- 0,
203
- 0,
204
- 0,
205
- 0,
206
- 0,
207
- 0,
208
- 0,
209
- 0,
210
- 0,
211
- 0,
212
- 0,
213
- 0,
214
- // 128 ...
215
- 0,
216
- 0,
217
- 0,
218
- 0,
219
- 0,
220
- 0,
221
- 0,
222
- 0,
223
- 0,
224
- 0,
225
- 0,
226
- 0,
227
- 0,
228
- 0,
229
- 0,
230
- 0,
231
- 0,
232
- 0,
233
- 0,
234
- 0,
235
- 0,
236
- 0,
237
- 0,
238
- 0,
239
- 0,
240
- 0,
241
- 0,
242
- 0,
243
- 0,
244
- 0,
245
- 0,
246
- 0,
247
- 0,
248
- 0,
249
- 0,
250
- 0,
251
- 0,
252
- 0,
253
- 0,
254
- 0,
255
- 0,
256
- 0,
257
- 0,
258
- 0,
259
- 0,
260
- 0,
261
- 0,
262
- 0,
263
- 0,
264
- 0,
265
- 0,
266
- 0,
267
- 0,
268
- 0,
269
- 0,
270
- 0,
271
- 0,
272
- 0,
273
- 0,
274
- 0,
275
- 0,
276
- 0,
277
- 0,
278
- 0,
279
- 0,
280
- 0,
281
- 0,
282
- 0,
283
- 0,
284
- 0,
285
- 0,
286
- 0,
287
- 0,
288
- 0,
289
- 0,
290
- 0,
291
- 0,
292
- 0,
293
- 0,
294
- 0,
295
- 0,
296
- 0,
297
- 0,
298
- 0,
299
- 0,
300
- 0,
301
- 0,
302
- 0,
303
- 0,
304
- 0,
305
- 0,
306
- 0,
307
- 0,
308
- 0,
309
- 0,
310
- 0,
311
- 0,
312
- 0,
313
- 0,
314
- 0,
315
- 0,
316
- 0,
317
- 0,
318
- 0,
319
- 0,
320
- 0,
321
- 0,
322
- 0,
323
- 0,
324
- 0,
325
- 0,
326
- 0
327
- // ... 256
83
+ 0,
84
+ 0,
85
+ 0,
86
+ 0,
87
+ 0,
88
+ 0,
89
+ 0,
90
+ 0,
91
+ 0,
92
+ 0,
93
+ 0,
94
+ 0,
95
+ 0,
96
+ 0,
97
+ 0,
98
+ 0,
99
+ 0,
100
+ 0,
101
+ 0,
102
+ 0,
103
+ 0,
104
+ 0,
105
+ 0,
106
+ 0,
107
+ 0,
108
+ 0,
109
+ 0,
110
+ 0,
111
+ 0,
112
+ 0,
113
+ 0,
114
+ 0,
115
+ 0,
116
+ 0,
117
+ 0,
118
+ 0,
119
+ 0,
120
+ 0,
121
+ 0,
122
+ 0,
123
+ 0,
124
+ 0,
125
+ 0,
126
+ 0,
127
+ 0,
128
+ 0,
129
+ 0,
130
+ 0,
131
+ 1,
132
+ 1,
133
+ 1,
134
+ 1,
135
+ 1,
136
+ 1,
137
+ 1,
138
+ 1,
139
+ 1,
140
+ 1,
141
+ 0,
142
+ 0,
143
+ 0,
144
+ 0,
145
+ 0,
146
+ 0,
147
+ 0,
148
+ 1,
149
+ 1,
150
+ 1,
151
+ 1,
152
+ 1,
153
+ 1,
154
+ 0,
155
+ 0,
156
+ 0,
157
+ 0,
158
+ 0,
159
+ 0,
160
+ 0,
161
+ 0,
162
+ 0,
163
+ 0,
164
+ 0,
165
+ 0,
166
+ 0,
167
+ 0,
168
+ 0,
169
+ 0,
170
+ 0,
171
+ 0,
172
+ 0,
173
+ 0,
174
+ 0,
175
+ 0,
176
+ 0,
177
+ 0,
178
+ 0,
179
+ 0,
180
+ 1,
181
+ 1,
182
+ 1,
183
+ 1,
184
+ 1,
185
+ 1,
186
+ 0,
187
+ 0,
188
+ 0,
189
+ 0,
190
+ 0,
191
+ 0,
192
+ 0,
193
+ 0,
194
+ 0,
195
+ 0,
196
+ 0,
197
+ 0,
198
+ 0,
199
+ 0,
200
+ 0,
201
+ 0,
202
+ 0,
203
+ 0,
204
+ 0,
205
+ 0,
206
+ 0,
207
+ 0,
208
+ 0,
209
+ 0,
210
+ 0,
211
+ 0,
212
+ 0,
213
+ 0,
214
+ 0,
215
+ 0,
216
+ 0,
217
+ 0,
218
+ 0,
219
+ 0,
220
+ 0,
221
+ 0,
222
+ 0,
223
+ 0,
224
+ 0,
225
+ 0,
226
+ 0,
227
+ 0,
228
+ 0,
229
+ 0,
230
+ 0,
231
+ 0,
232
+ 0,
233
+ 0,
234
+ 0,
235
+ 0,
236
+ 0,
237
+ 0,
238
+ 0,
239
+ 0,
240
+ 0,
241
+ 0,
242
+ 0,
243
+ 0,
244
+ 0,
245
+ 0,
246
+ 0,
247
+ 0,
248
+ 0,
249
+ 0,
250
+ 0,
251
+ 0,
252
+ 0,
253
+ 0,
254
+ 0,
255
+ 0,
256
+ 0,
257
+ 0,
258
+ 0,
259
+ 0,
260
+ 0,
261
+ 0,
262
+ 0,
263
+ 0,
264
+ 0,
265
+ 0,
266
+ 0,
267
+ 0,
268
+ 0,
269
+ 0,
270
+ 0,
271
+ 0,
272
+ 0,
273
+ 0,
274
+ 0,
275
+ 0,
276
+ 0,
277
+ 0,
278
+ 0,
279
+ 0,
280
+ 0,
281
+ 0,
282
+ 0,
283
+ 0,
284
+ 0,
285
+ 0,
286
+ 0,
287
+ 0,
288
+ 0,
289
+ 0,
290
+ 0,
291
+ 0,
292
+ 0,
293
+ 0,
294
+ 0,
295
+ 0,
296
+ 0,
297
+ 0,
298
+ 0,
299
+ 0,
300
+ 0,
301
+ 0,
302
+ 0,
303
+ 0,
304
+ 0,
305
+ 0,
306
+ 0,
307
+ 0,
308
+ 0,
309
+ 0,
310
+ 0,
311
+ 0,
312
+ 0,
313
+ 0,
314
+ 0,
315
+ 0,
316
+ 0,
317
+ 0,
318
+ 0,
319
+ 0,
320
+ 0,
321
+ 0,
322
+ 0,
323
+ 0,
324
+ 0,
325
+ 0,
326
+ 0,
327
+ 0,
328
+ 0,
329
+ 0,
330
+ 0,
331
+ 0,
332
+ 0,
333
+ 0,
334
+ 0,
335
+ 0,
336
+ 0,
337
+ 0,
338
+ 0
328
339
  ]);
329
340
  function charCodes(str) {
330
- const ret = new Array(str.length);
331
- for (let i = 0; i < str.length; ++i) {
332
- ret[i] = str.charCodeAt(i);
333
- }
334
- return ret;
341
+ const ret = new Array(str.length);
342
+ for (let i = 0; i < str.length; ++i) {
343
+ ret[i] = str.charCodeAt(i);
344
+ }
345
+ return ret;
335
346
  }
336
- function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode2) {
337
- if (key.length > 0 && keyEncoded) {
338
- try {
339
- key = decode2(key);
340
- } catch {
341
- }
342
- }
343
- if (value.length > 0 && valEncoded) {
344
- try {
345
- value = decode2(value);
346
- } catch {
347
- }
348
- }
349
- if (obj[key] === void 0) {
350
- obj[key] = value;
351
- } else {
352
- const curValue = obj[key];
353
- if (curValue.pop) {
354
- curValue[curValue.length] = value;
355
- } else {
356
- obj[key] = [curValue, value];
357
- }
358
- }
347
+ function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
348
+ if (key.length > 0 && keyEncoded) {
349
+ try {
350
+ key = decode(key);
351
+ } catch {}
352
+ }
353
+ if (value.length > 0 && valEncoded) {
354
+ try {
355
+ value = decode(value);
356
+ } catch {}
357
+ }
358
+ if (obj[key] === undefined) {
359
+ obj[key] = value;
360
+ } else {
361
+ const curValue = obj[key];
362
+ if (curValue.pop) {
363
+ curValue[curValue.length] = value;
364
+ } else {
365
+ obj[key] = [curValue, value];
366
+ }
367
+ }
359
368
  }
360
- function parse(str, sep = "&", eq = "=", { decodeURIComponent: decodeURIComponent2 = unescape, maxKeys = 1e3 } = {}) {
361
- const obj = /* @__PURE__ */ Object.create(null);
362
- if (typeof str !== "string" || str.length === 0) {
363
- return obj;
364
- }
365
- const sepCodes = !sep ? [38] : charCodes(String(sep));
366
- const eqCodes = !eq ? [61] : charCodes(String(eq));
367
- const sepLen = sepCodes.length;
368
- const eqLen = eqCodes.length;
369
- let pairs = 1e3;
370
- if (typeof maxKeys === "number") {
371
- pairs = maxKeys > 0 ? maxKeys : -1;
372
- }
373
- let decode2 = unescape;
374
- if (decodeURIComponent2) {
375
- decode2 = decodeURIComponent2;
376
- }
377
- const customDecode = decode2 !== unescape;
378
- let lastPos = 0;
379
- let sepIdx = 0;
380
- let eqIdx = 0;
381
- let key = "";
382
- let value = "";
383
- let keyEncoded = customDecode;
384
- let valEncoded = customDecode;
385
- const plusChar = customDecode ? "%20" : " ";
386
- let encodeCheck = 0;
387
- for (let i = 0; i < str.length; ++i) {
388
- const code = str.charCodeAt(i);
389
- if (code === sepCodes[sepIdx]) {
390
- if (++sepIdx === sepLen) {
391
- const end = i - sepIdx + 1;
392
- if (eqIdx < eqLen) {
393
- if (lastPos < end) {
394
- key += str.slice(lastPos, end);
395
- } else if (key.length === 0) {
396
- if (--pairs === 0) {
397
- return obj;
398
- }
399
- lastPos = i + 1;
400
- sepIdx = eqIdx = 0;
401
- continue;
402
- }
403
- } else if (lastPos < end) {
404
- value += str.slice(lastPos, end);
405
- }
406
- addKeyVal(obj, key, value, keyEncoded, valEncoded, decode2);
407
- if (--pairs === 0) {
408
- return obj;
409
- }
410
- key = value = "";
411
- encodeCheck = 0;
412
- lastPos = i + 1;
413
- sepIdx = eqIdx = 0;
414
- }
415
- } else {
416
- sepIdx = 0;
417
- if (eqIdx < eqLen) {
418
- if (code === eqCodes[eqIdx]) {
419
- if (++eqIdx === eqLen) {
420
- const end = i - eqIdx + 1;
421
- if (lastPos < end) {
422
- key += str.slice(lastPos, end);
423
- }
424
- encodeCheck = 0;
425
- lastPos = i + 1;
426
- }
427
- continue;
428
- } else {
429
- eqIdx = 0;
430
- if (!keyEncoded) {
431
- if (code === 37) {
432
- encodeCheck = 1;
433
- continue;
434
- } else if (encodeCheck > 0) {
435
- if (isHexTable[code] === 1) {
436
- if (++encodeCheck === 3) {
437
- keyEncoded = true;
438
- }
439
- continue;
440
- } else {
441
- encodeCheck = 0;
442
- }
443
- }
444
- }
445
- }
446
- if (code === 43) {
447
- if (lastPos < i) {
448
- key += str.slice(lastPos, i);
449
- }
450
- key += plusChar;
451
- lastPos = i + 1;
452
- continue;
453
- }
454
- }
455
- if (code === 43) {
456
- if (lastPos < i) {
457
- value += str.slice(lastPos, i);
458
- }
459
- value += plusChar;
460
- lastPos = i + 1;
461
- } else if (!valEncoded) {
462
- if (code === 37) {
463
- encodeCheck = 1;
464
- } else if (encodeCheck > 0) {
465
- if (isHexTable[code] === 1) {
466
- if (++encodeCheck === 3) {
467
- valEncoded = true;
468
- }
469
- } else {
470
- encodeCheck = 0;
471
- }
472
- }
473
- }
474
- }
475
- }
476
- if (lastPos < str.length) {
477
- if (eqIdx < eqLen) {
478
- key += str.slice(lastPos);
479
- } else if (sepIdx < sepLen) {
480
- value += str.slice(lastPos);
481
- }
482
- } else if (eqIdx === 0 && key.length === 0) {
483
- return obj;
484
- }
485
- addKeyVal(obj, key, value, keyEncoded, valEncoded, decode2);
486
- return obj;
369
+ /**
370
+ * Parses a URL query string into a collection of key and value pairs.
371
+ * @param str The URL query string to parse
372
+ * @param sep The substring used to delimit key and value pairs in the query string. Default: '&'.
373
+ * @param eq The substring used to delimit keys and values in the query string. Default: '='.
374
+ * @param options The parse options
375
+ * @param options.decodeURIComponent The function to use when decoding percent-encoded characters in the query string. Default: `querystring.unescape()`.
376
+ * @param options.maxKeys Specifies the maximum number of keys to parse. Specify `0` to remove key counting limitations. Default: `1000`.
377
+ * @legacy
378
+ * @see Tested in test-querystring.js
379
+ */
380
+ function parse(str, sep = "&", eq = "=", { decodeURIComponent = unescape, maxKeys = 1e3 } = {}) {
381
+ const obj = Object.create(null);
382
+ if (typeof str !== "string" || str.length === 0) {
383
+ return obj;
384
+ }
385
+ const sepCodes = !sep ? [38] : charCodes(String(sep));
386
+ const eqCodes = !eq ? [61] : charCodes(String(eq));
387
+ const sepLen = sepCodes.length;
388
+ const eqLen = eqCodes.length;
389
+ let pairs = 1e3;
390
+ if (typeof maxKeys === "number") {
391
+ pairs = maxKeys > 0 ? maxKeys : -1;
392
+ }
393
+ let decode = unescape;
394
+ if (decodeURIComponent) {
395
+ decode = decodeURIComponent;
396
+ }
397
+ const customDecode = decode !== unescape;
398
+ let lastPos = 0;
399
+ let sepIdx = 0;
400
+ let eqIdx = 0;
401
+ let key = "";
402
+ let value = "";
403
+ let keyEncoded = customDecode;
404
+ let valEncoded = customDecode;
405
+ const plusChar = customDecode ? "%20" : " ";
406
+ let encodeCheck = 0;
407
+ for (let i = 0; i < str.length; ++i) {
408
+ const code = str.charCodeAt(i);
409
+ if (code === sepCodes[sepIdx]) {
410
+ if (++sepIdx === sepLen) {
411
+ const end = i - sepIdx + 1;
412
+ if (eqIdx < eqLen) {
413
+ if (lastPos < end) {
414
+ key += str.slice(lastPos, end);
415
+ } else if (key.length === 0) {
416
+ if (--pairs === 0) {
417
+ return obj;
418
+ }
419
+ lastPos = i + 1;
420
+ sepIdx = eqIdx = 0;
421
+ continue;
422
+ }
423
+ } else if (lastPos < end) {
424
+ value += str.slice(lastPos, end);
425
+ }
426
+ addKeyVal(obj, key, value, keyEncoded, valEncoded, decode);
427
+ if (--pairs === 0) {
428
+ return obj;
429
+ }
430
+ key = value = "";
431
+ encodeCheck = 0;
432
+ lastPos = i + 1;
433
+ sepIdx = eqIdx = 0;
434
+ }
435
+ } else {
436
+ sepIdx = 0;
437
+ if (eqIdx < eqLen) {
438
+ if (code === eqCodes[eqIdx]) {
439
+ if (++eqIdx === eqLen) {
440
+ const end = i - eqIdx + 1;
441
+ if (lastPos < end) {
442
+ key += str.slice(lastPos, end);
443
+ }
444
+ encodeCheck = 0;
445
+ lastPos = i + 1;
446
+ }
447
+ continue;
448
+ } else {
449
+ eqIdx = 0;
450
+ if (!keyEncoded) {
451
+ if (code === 37) {
452
+ encodeCheck = 1;
453
+ continue;
454
+ } else if (encodeCheck > 0) {
455
+ if (isHexTable[code] === 1) {
456
+ if (++encodeCheck === 3) {
457
+ keyEncoded = true;
458
+ }
459
+ continue;
460
+ } else {
461
+ encodeCheck = 0;
462
+ }
463
+ }
464
+ }
465
+ }
466
+ if (code === 43) {
467
+ if (lastPos < i) {
468
+ key += str.slice(lastPos, i);
469
+ }
470
+ key += plusChar;
471
+ lastPos = i + 1;
472
+ continue;
473
+ }
474
+ }
475
+ if (code === 43) {
476
+ if (lastPos < i) {
477
+ value += str.slice(lastPos, i);
478
+ }
479
+ value += plusChar;
480
+ lastPos = i + 1;
481
+ } else if (!valEncoded) {
482
+ if (code === 37) {
483
+ encodeCheck = 1;
484
+ } else if (encodeCheck > 0) {
485
+ if (isHexTable[code] === 1) {
486
+ if (++encodeCheck === 3) {
487
+ valEncoded = true;
488
+ }
489
+ } else {
490
+ encodeCheck = 0;
491
+ }
492
+ }
493
+ }
494
+ }
495
+ }
496
+ if (lastPos < str.length) {
497
+ if (eqIdx < eqLen) {
498
+ key += str.slice(lastPos);
499
+ } else if (sepIdx < sepLen) {
500
+ value += str.slice(lastPos);
501
+ }
502
+ } else if (eqIdx === 0 && key.length === 0) {
503
+ return obj;
504
+ }
505
+ addKeyVal(obj, key, value, keyEncoded, valEncoded, decode);
506
+ return obj;
487
507
  }
508
+ /**
509
+ * These characters do not need escaping when generating query strings:
510
+ * ! - . _ ~
511
+ * ' ( ) *
512
+ * digits
513
+ * alpha (uppercase)
514
+ * alpha (lowercase)
515
+ */
488
516
  const noEscape = new Int8Array([
489
- 0,
490
- 0,
491
- 0,
492
- 0,
493
- 0,
494
- 0,
495
- 0,
496
- 0,
497
- 0,
498
- 0,
499
- 0,
500
- 0,
501
- 0,
502
- 0,
503
- 0,
504
- 0,
505
- // 0 - 15
506
- 0,
507
- 0,
508
- 0,
509
- 0,
510
- 0,
511
- 0,
512
- 0,
513
- 0,
514
- 0,
515
- 0,
516
- 0,
517
- 0,
518
- 0,
519
- 0,
520
- 0,
521
- 0,
522
- // 16 - 31
523
- 0,
524
- 1,
525
- 0,
526
- 0,
527
- 0,
528
- 0,
529
- 0,
530
- 1,
531
- 1,
532
- 1,
533
- 1,
534
- 0,
535
- 0,
536
- 1,
537
- 1,
538
- 0,
539
- // 32 - 47
540
- 1,
541
- 1,
542
- 1,
543
- 1,
544
- 1,
545
- 1,
546
- 1,
547
- 1,
548
- 1,
549
- 1,
550
- 0,
551
- 0,
552
- 0,
553
- 0,
554
- 0,
555
- 0,
556
- // 48 - 63
557
- 0,
558
- 1,
559
- 1,
560
- 1,
561
- 1,
562
- 1,
563
- 1,
564
- 1,
565
- 1,
566
- 1,
567
- 1,
568
- 1,
569
- 1,
570
- 1,
571
- 1,
572
- 1,
573
- // 64 - 79
574
- 1,
575
- 1,
576
- 1,
577
- 1,
578
- 1,
579
- 1,
580
- 1,
581
- 1,
582
- 1,
583
- 1,
584
- 1,
585
- 0,
586
- 0,
587
- 0,
588
- 0,
589
- 1,
590
- // 80 - 95
591
- 0,
592
- 1,
593
- 1,
594
- 1,
595
- 1,
596
- 1,
597
- 1,
598
- 1,
599
- 1,
600
- 1,
601
- 1,
602
- 1,
603
- 1,
604
- 1,
605
- 1,
606
- 1,
607
- // 96 - 111
608
- 1,
609
- 1,
610
- 1,
611
- 1,
612
- 1,
613
- 1,
614
- 1,
615
- 1,
616
- 1,
617
- 1,
618
- 1,
619
- 0,
620
- 0,
621
- 0,
622
- 1,
623
- 0
624
- // 112 - 127
517
+ 0,
518
+ 0,
519
+ 0,
520
+ 0,
521
+ 0,
522
+ 0,
523
+ 0,
524
+ 0,
525
+ 0,
526
+ 0,
527
+ 0,
528
+ 0,
529
+ 0,
530
+ 0,
531
+ 0,
532
+ 0,
533
+ 0,
534
+ 0,
535
+ 0,
536
+ 0,
537
+ 0,
538
+ 0,
539
+ 0,
540
+ 0,
541
+ 0,
542
+ 0,
543
+ 0,
544
+ 0,
545
+ 0,
546
+ 0,
547
+ 0,
548
+ 0,
549
+ 0,
550
+ 1,
551
+ 0,
552
+ 0,
553
+ 0,
554
+ 0,
555
+ 0,
556
+ 1,
557
+ 1,
558
+ 1,
559
+ 1,
560
+ 0,
561
+ 0,
562
+ 1,
563
+ 1,
564
+ 0,
565
+ 1,
566
+ 1,
567
+ 1,
568
+ 1,
569
+ 1,
570
+ 1,
571
+ 1,
572
+ 1,
573
+ 1,
574
+ 1,
575
+ 0,
576
+ 0,
577
+ 0,
578
+ 0,
579
+ 0,
580
+ 0,
581
+ 0,
582
+ 1,
583
+ 1,
584
+ 1,
585
+ 1,
586
+ 1,
587
+ 1,
588
+ 1,
589
+ 1,
590
+ 1,
591
+ 1,
592
+ 1,
593
+ 1,
594
+ 1,
595
+ 1,
596
+ 1,
597
+ 1,
598
+ 1,
599
+ 1,
600
+ 1,
601
+ 1,
602
+ 1,
603
+ 1,
604
+ 1,
605
+ 1,
606
+ 1,
607
+ 1,
608
+ 0,
609
+ 0,
610
+ 0,
611
+ 0,
612
+ 1,
613
+ 0,
614
+ 1,
615
+ 1,
616
+ 1,
617
+ 1,
618
+ 1,
619
+ 1,
620
+ 1,
621
+ 1,
622
+ 1,
623
+ 1,
624
+ 1,
625
+ 1,
626
+ 1,
627
+ 1,
628
+ 1,
629
+ 1,
630
+ 1,
631
+ 1,
632
+ 1,
633
+ 1,
634
+ 1,
635
+ 1,
636
+ 1,
637
+ 1,
638
+ 1,
639
+ 1,
640
+ 0,
641
+ 0,
642
+ 0,
643
+ 1,
644
+ 0
625
645
  ]);
626
646
  function stringifyPrimitive(v) {
627
- if (typeof v === "string") {
628
- return v;
629
- }
630
- if (typeof v === "number" && isFinite(v)) {
631
- return "" + v;
632
- }
633
- if (typeof v === "bigint") {
634
- return "" + v;
635
- }
636
- if (typeof v === "boolean") {
637
- return v ? "true" : "false";
638
- }
639
- return "";
647
+ if (typeof v === "string") {
648
+ return v;
649
+ }
650
+ if (typeof v === "number" && isFinite(v)) {
651
+ return "" + v;
652
+ }
653
+ if (typeof v === "bigint") {
654
+ return "" + v;
655
+ }
656
+ if (typeof v === "boolean") {
657
+ return v ? "true" : "false";
658
+ }
659
+ return "";
640
660
  }
641
- function encodeStringifiedCustom(v, encode2) {
642
- return encode2(stringifyPrimitive(v));
661
+ function encodeStringifiedCustom(v, encode) {
662
+ return encode(stringifyPrimitive(v));
643
663
  }
644
- function encodeStringified(v, encode2) {
645
- if (typeof v === "string") {
646
- return v.length ? encode2(v) : "";
647
- }
648
- if (typeof v === "number" && isFinite(v)) {
649
- return Math.abs(v) < 1e21 ? "" + v : encode2("" + v);
650
- }
651
- if (typeof v === "bigint") {
652
- return "" + v;
653
- }
654
- if (typeof v === "boolean") {
655
- return v ? "true" : "false";
656
- }
657
- return "";
664
+ function encodeStringified(v, encode) {
665
+ if (typeof v === "string") {
666
+ return v.length ? encode(v) : "";
667
+ }
668
+ if (typeof v === "number" && isFinite(v)) {
669
+ return Math.abs(v) < 1e21 ? "" + v : encode("" + v);
670
+ }
671
+ if (typeof v === "bigint") {
672
+ return "" + v;
673
+ }
674
+ if (typeof v === "boolean") {
675
+ return v ? "true" : "false";
676
+ }
677
+ return "";
658
678
  }
679
+ /**
680
+ * Produces a URL query string from a given obj by iterating through the object's "own properties".
681
+ * @param obj The object to serialize into a URL query string.
682
+ * @param sep The substring used to delimit key and value pairs in the query string. Default: '&'.
683
+ * @param eq The substring used to delimit keys and values in the query string. Default: '='.
684
+ * @param options The stringify options
685
+ * @param options.encodeURIComponent The function to use when converting URL-unsafe characters to percent-encoding in the query string. Default: `querystring.escape()`.
686
+ * @legacy
687
+ * @see Tested in `test-querystring.js`
688
+ */
659
689
  function stringify(obj, sep, eq, options) {
660
- sep ||= "&";
661
- eq ||= "=";
662
- const encode2 = options ? options.encodeURIComponent : qsEscape;
663
- const convert = options ? encodeStringifiedCustom : encodeStringified;
664
- if (obj !== null && typeof obj === "object") {
665
- const keys = Object.keys(obj);
666
- const len = keys.length;
667
- let fields = "";
668
- for (let i = 0; i < len; ++i) {
669
- const k = keys[i];
670
- const v = obj[k];
671
- let ks = convert(k, encode2);
672
- ks += eq;
673
- if (Array.isArray(v)) {
674
- const vlen = v.length;
675
- if (vlen === 0) continue;
676
- if (fields) {
677
- fields += sep;
678
- }
679
- for (let j = 0; j < vlen; ++j) {
680
- if (j) {
681
- fields += sep;
682
- }
683
- fields += ks;
684
- fields += convert(v[j], encode2);
685
- }
686
- } else {
687
- if (fields) {
688
- fields += sep;
689
- }
690
- fields += ks;
691
- fields += convert(v, encode2);
692
- }
693
- }
694
- return fields;
695
- }
696
- return "";
690
+ sep ||= "&";
691
+ eq ||= "=";
692
+ const encode = options ? options.encodeURIComponent : qsEscape;
693
+ const convert = options ? encodeStringifiedCustom : encodeStringified;
694
+ if (obj !== null && typeof obj === "object") {
695
+ const keys = Object.keys(obj);
696
+ const len = keys.length;
697
+ let fields = "";
698
+ for (let i = 0; i < len; ++i) {
699
+ const k = keys[i];
700
+ const v = obj[k];
701
+ let ks = convert(k, encode);
702
+ ks += eq;
703
+ if (Array.isArray(v)) {
704
+ const vlen = v.length;
705
+ if (vlen === 0) continue;
706
+ if (fields) {
707
+ fields += sep;
708
+ }
709
+ for (let j = 0; j < vlen; ++j) {
710
+ if (j) {
711
+ fields += sep;
712
+ }
713
+ fields += ks;
714
+ fields += convert(v[j], encode);
715
+ }
716
+ } else {
717
+ if (fields) {
718
+ fields += sep;
719
+ }
720
+ fields += ks;
721
+ fields += convert(v, encode);
722
+ }
723
+ }
724
+ return fields;
725
+ }
726
+ return "";
697
727
  }
698
728
  const unhexTable = new Int8Array([
699
- -1,
700
- -1,
701
- -1,
702
- -1,
703
- -1,
704
- -1,
705
- -1,
706
- -1,
707
- -1,
708
- -1,
709
- -1,
710
- -1,
711
- -1,
712
- -1,
713
- -1,
714
- -1,
715
- // 0 - 15
716
- -1,
717
- -1,
718
- -1,
719
- -1,
720
- -1,
721
- -1,
722
- -1,
723
- -1,
724
- -1,
725
- -1,
726
- -1,
727
- -1,
728
- -1,
729
- -1,
730
- -1,
731
- -1,
732
- // 16 - 31
733
- -1,
734
- -1,
735
- -1,
736
- -1,
737
- -1,
738
- -1,
739
- -1,
740
- -1,
741
- -1,
742
- -1,
743
- -1,
744
- -1,
745
- -1,
746
- -1,
747
- -1,
748
- -1,
749
- // 32 - 47
750
- 0,
751
- 1,
752
- 2,
753
- 3,
754
- 4,
755
- 5,
756
- 6,
757
- 7,
758
- 8,
759
- 9,
760
- -1,
761
- -1,
762
- -1,
763
- -1,
764
- -1,
765
- -1,
766
- // 48 - 63
767
- -1,
768
- 10,
769
- 11,
770
- 12,
771
- 13,
772
- 14,
773
- 15,
774
- -1,
775
- -1,
776
- -1,
777
- -1,
778
- -1,
779
- -1,
780
- -1,
781
- -1,
782
- -1,
783
- // 64 - 79
784
- -1,
785
- -1,
786
- -1,
787
- -1,
788
- -1,
789
- -1,
790
- -1,
791
- -1,
792
- -1,
793
- -1,
794
- -1,
795
- -1,
796
- -1,
797
- -1,
798
- -1,
799
- -1,
800
- // 80 - 95
801
- -1,
802
- 10,
803
- 11,
804
- 12,
805
- 13,
806
- 14,
807
- 15,
808
- -1,
809
- -1,
810
- -1,
811
- -1,
812
- -1,
813
- -1,
814
- -1,
815
- -1,
816
- -1,
817
- // 96 - 111
818
- -1,
819
- -1,
820
- -1,
821
- -1,
822
- -1,
823
- -1,
824
- -1,
825
- -1,
826
- -1,
827
- -1,
828
- -1,
829
- -1,
830
- -1,
831
- -1,
832
- -1,
833
- -1,
834
- // 112 - 127
835
- -1,
836
- -1,
837
- -1,
838
- -1,
839
- -1,
840
- -1,
841
- -1,
842
- -1,
843
- -1,
844
- -1,
845
- -1,
846
- -1,
847
- -1,
848
- -1,
849
- -1,
850
- -1,
851
- // 128 ...
852
- -1,
853
- -1,
854
- -1,
855
- -1,
856
- -1,
857
- -1,
858
- -1,
859
- -1,
860
- -1,
861
- -1,
862
- -1,
863
- -1,
864
- -1,
865
- -1,
866
- -1,
867
- -1,
868
- -1,
869
- -1,
870
- -1,
871
- -1,
872
- -1,
873
- -1,
874
- -1,
875
- -1,
876
- -1,
877
- -1,
878
- -1,
879
- -1,
880
- -1,
881
- -1,
882
- -1,
883
- -1,
884
- -1,
885
- -1,
886
- -1,
887
- -1,
888
- -1,
889
- -1,
890
- -1,
891
- -1,
892
- -1,
893
- -1,
894
- -1,
895
- -1,
896
- -1,
897
- -1,
898
- -1,
899
- -1,
900
- -1,
901
- -1,
902
- -1,
903
- -1,
904
- -1,
905
- -1,
906
- -1,
907
- -1,
908
- -1,
909
- -1,
910
- -1,
911
- -1,
912
- -1,
913
- -1,
914
- -1,
915
- -1,
916
- -1,
917
- -1,
918
- -1,
919
- -1,
920
- -1,
921
- -1,
922
- -1,
923
- -1,
924
- -1,
925
- -1,
926
- -1,
927
- -1,
928
- -1,
929
- -1,
930
- -1,
931
- -1,
932
- -1,
933
- -1,
934
- -1,
935
- -1,
936
- -1,
937
- -1,
938
- -1,
939
- -1,
940
- -1,
941
- -1,
942
- -1,
943
- -1,
944
- -1,
945
- -1,
946
- -1,
947
- -1,
948
- -1,
949
- -1,
950
- -1,
951
- -1,
952
- -1,
953
- -1,
954
- -1,
955
- -1,
956
- -1,
957
- -1,
958
- -1,
959
- -1,
960
- -1,
961
- -1,
962
- -1,
963
- -1
964
- // ... 255
729
+ -1,
730
+ -1,
731
+ -1,
732
+ -1,
733
+ -1,
734
+ -1,
735
+ -1,
736
+ -1,
737
+ -1,
738
+ -1,
739
+ -1,
740
+ -1,
741
+ -1,
742
+ -1,
743
+ -1,
744
+ -1,
745
+ -1,
746
+ -1,
747
+ -1,
748
+ -1,
749
+ -1,
750
+ -1,
751
+ -1,
752
+ -1,
753
+ -1,
754
+ -1,
755
+ -1,
756
+ -1,
757
+ -1,
758
+ -1,
759
+ -1,
760
+ -1,
761
+ -1,
762
+ -1,
763
+ -1,
764
+ -1,
765
+ -1,
766
+ -1,
767
+ -1,
768
+ -1,
769
+ -1,
770
+ -1,
771
+ -1,
772
+ -1,
773
+ -1,
774
+ -1,
775
+ -1,
776
+ -1,
777
+ +0,
778
+ +1,
779
+ +2,
780
+ +3,
781
+ +4,
782
+ +5,
783
+ +6,
784
+ +7,
785
+ +8,
786
+ +9,
787
+ -1,
788
+ -1,
789
+ -1,
790
+ -1,
791
+ -1,
792
+ -1,
793
+ -1,
794
+ 10,
795
+ 11,
796
+ 12,
797
+ 13,
798
+ 14,
799
+ 15,
800
+ -1,
801
+ -1,
802
+ -1,
803
+ -1,
804
+ -1,
805
+ -1,
806
+ -1,
807
+ -1,
808
+ -1,
809
+ -1,
810
+ -1,
811
+ -1,
812
+ -1,
813
+ -1,
814
+ -1,
815
+ -1,
816
+ -1,
817
+ -1,
818
+ -1,
819
+ -1,
820
+ -1,
821
+ -1,
822
+ -1,
823
+ -1,
824
+ -1,
825
+ -1,
826
+ 10,
827
+ 11,
828
+ 12,
829
+ 13,
830
+ 14,
831
+ 15,
832
+ -1,
833
+ -1,
834
+ -1,
835
+ -1,
836
+ -1,
837
+ -1,
838
+ -1,
839
+ -1,
840
+ -1,
841
+ -1,
842
+ -1,
843
+ -1,
844
+ -1,
845
+ -1,
846
+ -1,
847
+ -1,
848
+ -1,
849
+ -1,
850
+ -1,
851
+ -1,
852
+ -1,
853
+ -1,
854
+ -1,
855
+ -1,
856
+ -1,
857
+ -1,
858
+ -1,
859
+ -1,
860
+ -1,
861
+ -1,
862
+ -1,
863
+ -1,
864
+ -1,
865
+ -1,
866
+ -1,
867
+ -1,
868
+ -1,
869
+ -1,
870
+ -1,
871
+ -1,
872
+ -1,
873
+ -1,
874
+ -1,
875
+ -1,
876
+ -1,
877
+ -1,
878
+ -1,
879
+ -1,
880
+ -1,
881
+ -1,
882
+ -1,
883
+ -1,
884
+ -1,
885
+ -1,
886
+ -1,
887
+ -1,
888
+ -1,
889
+ -1,
890
+ -1,
891
+ -1,
892
+ -1,
893
+ -1,
894
+ -1,
895
+ -1,
896
+ -1,
897
+ -1,
898
+ -1,
899
+ -1,
900
+ -1,
901
+ -1,
902
+ -1,
903
+ -1,
904
+ -1,
905
+ -1,
906
+ -1,
907
+ -1,
908
+ -1,
909
+ -1,
910
+ -1,
911
+ -1,
912
+ -1,
913
+ -1,
914
+ -1,
915
+ -1,
916
+ -1,
917
+ -1,
918
+ -1,
919
+ -1,
920
+ -1,
921
+ -1,
922
+ -1,
923
+ -1,
924
+ -1,
925
+ -1,
926
+ -1,
927
+ -1,
928
+ -1,
929
+ -1,
930
+ -1,
931
+ -1,
932
+ -1,
933
+ -1,
934
+ -1,
935
+ -1,
936
+ -1,
937
+ -1,
938
+ -1,
939
+ -1,
940
+ -1,
941
+ -1,
942
+ -1,
943
+ -1,
944
+ -1,
945
+ -1,
946
+ -1,
947
+ -1,
948
+ -1,
949
+ -1,
950
+ -1,
951
+ -1,
952
+ -1,
953
+ -1,
954
+ -1,
955
+ -1,
956
+ -1,
957
+ -1,
958
+ -1,
959
+ -1,
960
+ -1,
961
+ -1,
962
+ -1,
963
+ -1,
964
+ -1,
965
+ -1,
966
+ -1,
967
+ -1,
968
+ -1,
969
+ -1,
970
+ -1,
971
+ -1,
972
+ -1,
973
+ -1,
974
+ -1,
975
+ -1,
976
+ -1,
977
+ -1,
978
+ -1,
979
+ -1,
980
+ -1,
981
+ -1,
982
+ -1,
983
+ -1,
984
+ -1
965
985
  ]);
986
+ /**
987
+ * A safe fast alternative to decodeURIComponent
988
+ */
966
989
  function unescapeBuffer(s, decodeSpaces = false) {
967
- const out = new Buffer(s.length);
968
- let index = 0;
969
- let outIndex = 0;
970
- let currentChar;
971
- let nextChar;
972
- let hexHigh;
973
- let hexLow;
974
- const maxLength = s.length - 2;
975
- let hasHex = false;
976
- while (index < s.length) {
977
- currentChar = s.charCodeAt(index);
978
- if (currentChar === 43 && decodeSpaces) {
979
- out[outIndex++] = 32;
980
- index++;
981
- continue;
982
- }
983
- if (currentChar === 37 && index < maxLength) {
984
- currentChar = s.charCodeAt(++index);
985
- hexHigh = unhexTable[currentChar];
986
- if (!(hexHigh >= 0)) {
987
- out[outIndex++] = 37;
988
- continue;
989
- } else {
990
- nextChar = s.charCodeAt(++index);
991
- hexLow = unhexTable[nextChar];
992
- if (!(hexLow >= 0)) {
993
- out[outIndex++] = 37;
994
- index--;
995
- } else {
996
- hasHex = true;
997
- currentChar = hexHigh * 16 + hexLow;
998
- }
999
- }
1000
- }
1001
- out[outIndex++] = currentChar;
1002
- index++;
1003
- }
1004
- return hasHex ? out.slice(0, outIndex) : out;
990
+ const out = new Buffer(s.length);
991
+ let index = 0;
992
+ let outIndex = 0;
993
+ let currentChar;
994
+ let nextChar;
995
+ let hexHigh;
996
+ let hexLow;
997
+ const maxLength = s.length - 2;
998
+ let hasHex = false;
999
+ while (index < s.length) {
1000
+ currentChar = s.charCodeAt(index);
1001
+ if (currentChar === 43 && decodeSpaces) {
1002
+ out[outIndex++] = 32;
1003
+ index++;
1004
+ continue;
1005
+ }
1006
+ if (currentChar === 37 && index < maxLength) {
1007
+ currentChar = s.charCodeAt(++index);
1008
+ hexHigh = unhexTable[currentChar];
1009
+ if (!(hexHigh >= 0)) {
1010
+ out[outIndex++] = 37;
1011
+ continue;
1012
+ } else {
1013
+ nextChar = s.charCodeAt(++index);
1014
+ hexLow = unhexTable[nextChar];
1015
+ if (!(hexLow >= 0)) {
1016
+ out[outIndex++] = 37;
1017
+ index--;
1018
+ } else {
1019
+ hasHex = true;
1020
+ currentChar = hexHigh * 16 + hexLow;
1021
+ }
1022
+ }
1023
+ }
1024
+ out[outIndex++] = currentChar;
1025
+ index++;
1026
+ }
1027
+ return hasHex ? out.slice(0, outIndex) : out;
1005
1028
  }
1006
1029
  function qsUnescape(s) {
1007
- try {
1008
- return decodeURIComponent(s);
1009
- } catch {
1010
- return unescapeBuffer(s).toString();
1011
- }
1030
+ try {
1031
+ return decodeURIComponent(s);
1032
+ } catch {
1033
+ return unescapeBuffer(s).toString();
1034
+ }
1012
1035
  }
1036
+ /**
1037
+ * Performs decoding of URL percent-encoded characters on the given `str`.
1038
+ * Used by `querystring.parse()` and is generally not expected to be used directly.
1039
+ * It is exported primarily to allow application code to provide a replacement decoding implementation if necessary by assigning `querystring.unescape` to an alternative function.
1040
+ * @legacy
1041
+ * @see Tested in `test-querystring-escape.js`
1042
+ */
1013
1043
  const unescape = qsUnescape;
1014
- var index_default = {
1015
- parse,
1016
- stringify,
1017
- decode,
1018
- encode,
1019
- unescape,
1020
- escape,
1021
- unescapeBuffer
1022
- };
1023
- export {
1024
- ERR_INVALID_URI,
1025
- decode,
1026
- index_default as default,
1027
- encode,
1028
- escape,
1029
- parse,
1030
- stringify,
1031
- unescape,
1032
- unescapeBuffer
1044
+ var src_default = {
1045
+ parse,
1046
+ stringify,
1047
+ decode,
1048
+ encode,
1049
+ unescape,
1050
+ escape,
1051
+ unescapeBuffer
1033
1052
  };
1053
+
1054
+ //#endregion
1055
+ export { ERR_INVALID_URI, decode, src_default as default, encode, escape, parse, stringify, unescape, unescapeBuffer };