윤규리

rebase

1 +<<<<<<< HEAD
1 const { response } = require('express'); 2 const { response } = require('express');
2 const fetch = require('node-fetch') 3 const fetch = require('node-fetch')
3 4
...@@ -92,4 +93,18 @@ function getXY(hospitals, addNum) { ...@@ -92,4 +93,18 @@ function getXY(hospitals, addNum) {
92 // for loop 다 돈 다음에 return하도록 수정해야함 (하실수 있는분?) 93 // for loop 다 돈 다음에 return하도록 수정해야함 (하실수 있는분?)
93 } 94 }
94 95
95 -module.exports = {getAddress, getXY};
...\ No newline at end of file ...\ No newline at end of file
96 +module.exports = {getAddress, getXY};
97 +=======
98 +// 모듈을 읽어 들입니다.
99 +const request = require('request');
100 +// 요청을 위한 상수를 선언합니다: TOKEN은 자신의 것을 입력해주세요.
101 +const TARGET_URL = 'https://notify-api.line.me/api/notify';
102 +const TOKEN = '2lGVtxPmn2VOsRczarnwqvQ6cMFOpCMnk3QHA4Ykd2E';
103 +
104 +GET /v2/local/search/address.${FORMAT} HTTP/1.1
105 +Host: dapi.kakao.com
106 +Authorization: KakaoAK ${REST_API_KEY}
107 +
108 +curl -X GET "https://dapi.kakao.com/v2/local/search/address.json?analyze_type=similar&page=1&size=10&query=${ask}" \
109 + -H "Authorization: KakaoAK c14234ba46c574c73715276c5644f397"
110 +>>>>>>> bef06db (Init Address.js)
......
...@@ -55,10 +55,34 @@ try { ...@@ -55,10 +55,34 @@ try {
55 cert: fs.readFileSync('./rootca.crt' ,'utf8'), 55 cert: fs.readFileSync('./rootca.crt' ,'utf8'),
56 }; 56 };
57 57
58 +<<<<<<< HEAD
58 HTTPS.createServer(option, app).listen(sslport, () => { 59 HTTPS.createServer(option, app).listen(sslport, () => {
59 console.log(`[HTTPS] Server is started on port ${sslport}`); 60 console.log(`[HTTPS] Server is started on port ${sslport}`);
60 }); 61 });
61 } catch (error) { 62 } catch (error) {
62 console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'); 63 console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
63 console.log(error); 64 console.log(error);
64 - }
...\ No newline at end of file ...\ No newline at end of file
65 + }
66 +=======
67 + if (question === '테스트') {
68 + const data = {
69 + 'version': '2.0',
70 + 'template': {
71 + 'outputs': [{
72 + 'simpleText': {
73 + 'text': '테스트'
74 + }
75 + }],
76 + 'quickReplies': [{
77 + 'label': goMain,
78 + 'action': 'message',
79 + 'messageText': goMain
80 + }]
81 + }
82 + }
83 + }
84 + res.json(data);
85 +});
86 +
87 +app.listen(23023, () => console.log('node on 23023'));
88 +>>>>>>> bef06db (Init Address.js)
......
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
4 "requires": true, 4 "requires": true,
5 "packages": { 5 "packages": {
6 <<<<<<< HEAD 6 <<<<<<< HEAD
7 +<<<<<<< HEAD
8 +=======
7 ======= 9 =======
10 +>>>>>>> bef06db (Init Address.js)
8 "node_modules/accepts": { 11 "node_modules/accepts": {
9 "version": "1.3.8", 12 "version": "1.3.8",
10 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", 13 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
...@@ -17,6 +20,7 @@ ...@@ -17,6 +20,7 @@
17 "node": ">= 0.6" 20 "node": ">= 0.6"
18 } 21 }
19 }, 22 },
23 +<<<<<<< HEAD
20 >>>>>>> main 24 >>>>>>> main
21 "node_modules/ajv": { 25 "node_modules/ajv": {
22 "version": "6.12.6", 26 "version": "6.12.6",
...@@ -35,11 +39,14 @@ ...@@ -35,11 +39,14 @@
35 }, 39 },
36 <<<<<<< HEAD 40 <<<<<<< HEAD
37 ======= 41 =======
42 +=======
43 +>>>>>>> bef06db (Init Address.js)
38 "node_modules/array-flatten": { 44 "node_modules/array-flatten": {
39 "version": "1.1.1", 45 "version": "1.1.1",
40 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 46 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
41 "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" 47 "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
42 }, 48 },
49 +<<<<<<< HEAD
43 >>>>>>> main 50 >>>>>>> main
44 "node_modules/asn1": { 51 "node_modules/asn1": {
45 "version": "0.2.6", 52 "version": "0.2.6",
...@@ -85,6 +92,8 @@ ...@@ -85,6 +92,8 @@
85 }, 92 },
86 <<<<<<< HEAD 93 <<<<<<< HEAD
87 ======= 94 =======
95 +=======
96 +>>>>>>> bef06db (Init Address.js)
88 "node_modules/body-parser": { 97 "node_modules/body-parser": {
89 "version": "1.20.1", 98 "version": "1.20.1",
90 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", 99 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
...@@ -108,6 +117,7 @@ ...@@ -108,6 +117,7 @@
108 "npm": "1.2.8000 || >= 1.4.16" 117 "npm": "1.2.8000 || >= 1.4.16"
109 } 118 }
110 }, 119 },
120 +<<<<<<< HEAD
111 "node_modules/body-parser/node_modules/qs": { 121 "node_modules/body-parser/node_modules/qs": {
112 "version": "6.11.0", 122 "version": "6.11.0",
113 "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 123 "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
...@@ -122,6 +132,8 @@ ...@@ -122,6 +132,8 @@
122 "url": "https://github.com/sponsors/ljharb" 132 "url": "https://github.com/sponsors/ljharb"
123 } 133 }
124 }, 134 },
135 +=======
136 +>>>>>>> bef06db (Init Address.js)
125 "node_modules/bytes": { 137 "node_modules/bytes": {
126 "version": "3.1.2", 138 "version": "3.1.2",
127 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 139 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
...@@ -142,6 +154,7 @@ ...@@ -142,6 +154,7 @@
142 "url": "https://github.com/sponsors/ljharb" 154 "url": "https://github.com/sponsors/ljharb"
143 } 155 }
144 }, 156 },
157 +<<<<<<< HEAD
145 >>>>>>> main 158 >>>>>>> main
146 "node_modules/caseless": { 159 "node_modules/caseless": {
147 "version": "0.12.0", 160 "version": "0.12.0",
...@@ -161,6 +174,8 @@ ...@@ -161,6 +174,8 @@
161 }, 174 },
162 <<<<<<< HEAD 175 <<<<<<< HEAD
163 ======= 176 =======
177 +=======
178 +>>>>>>> bef06db (Init Address.js)
164 "node_modules/content-disposition": { 179 "node_modules/content-disposition": {
165 "version": "0.5.4", 180 "version": "0.5.4",
166 "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 181 "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
...@@ -193,6 +208,7 @@ ...@@ -193,6 +208,7 @@
193 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 208 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
194 "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 209 "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
195 }, 210 },
211 +<<<<<<< HEAD
196 >>>>>>> main 212 >>>>>>> main
197 "node_modules/core-util-is": { 213 "node_modules/core-util-is": {
198 "version": "1.0.2", 214 "version": "1.0.2",
...@@ -212,6 +228,8 @@ ...@@ -212,6 +228,8 @@
212 }, 228 },
213 <<<<<<< HEAD 229 <<<<<<< HEAD
214 ======= 230 =======
231 +=======
232 +>>>>>>> bef06db (Init Address.js)
215 "node_modules/debug": { 233 "node_modules/debug": {
216 "version": "2.6.9", 234 "version": "2.6.9",
217 "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 235 "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
...@@ -220,6 +238,7 @@ ...@@ -220,6 +238,7 @@
220 "ms": "2.0.0" 238 "ms": "2.0.0"
221 } 239 }
222 }, 240 },
241 +<<<<<<< HEAD
223 >>>>>>> main 242 >>>>>>> main
224 "node_modules/delayed-stream": { 243 "node_modules/delayed-stream": {
225 "version": "1.0.0", 244 "version": "1.0.0",
...@@ -231,6 +250,8 @@ ...@@ -231,6 +250,8 @@
231 }, 250 },
232 <<<<<<< HEAD 251 <<<<<<< HEAD
233 ======= 252 =======
253 +=======
254 +>>>>>>> bef06db (Init Address.js)
234 "node_modules/depd": { 255 "node_modules/depd": {
235 "version": "2.0.0", 256 "version": "2.0.0",
236 "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 257 "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
...@@ -248,6 +269,7 @@ ...@@ -248,6 +269,7 @@
248 "npm": "1.2.8000 || >= 1.4.16" 269 "npm": "1.2.8000 || >= 1.4.16"
249 } 270 }
250 }, 271 },
272 +<<<<<<< HEAD
251 >>>>>>> main 273 >>>>>>> main
252 "node_modules/ecc-jsbn": { 274 "node_modules/ecc-jsbn": {
253 "version": "0.1.2", 275 "version": "0.1.2",
...@@ -260,6 +282,8 @@ ...@@ -260,6 +282,8 @@
260 }, 282 },
261 <<<<<<< HEAD 283 <<<<<<< HEAD
262 ======= 284 =======
285 +=======
286 +>>>>>>> bef06db (Init Address.js)
263 "node_modules/ee-first": { 287 "node_modules/ee-first": {
264 "version": "1.1.1", 288 "version": "1.1.1",
265 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 289 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
...@@ -273,6 +297,7 @@ ...@@ -273,6 +297,7 @@
273 "node": ">= 0.8" 297 "node": ">= 0.8"
274 } 298 }
275 }, 299 },
300 +<<<<<<< HEAD
276 "node_modules/encoding": { 301 "node_modules/encoding": {
277 "version": "0.1.13", 302 "version": "0.1.13",
278 "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", 303 "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
...@@ -292,6 +317,8 @@ ...@@ -292,6 +317,8 @@
292 "node": ">=0.10.0" 317 "node": ">=0.10.0"
293 } 318 }
294 }, 319 },
320 +=======
321 +>>>>>>> bef06db (Init Address.js)
295 "node_modules/escape-html": { 322 "node_modules/escape-html": {
296 "version": "1.0.3", 323 "version": "1.0.3",
297 "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 324 "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
...@@ -346,6 +373,7 @@ ...@@ -346,6 +373,7 @@
346 "node": ">= 0.10.0" 373 "node": ">= 0.10.0"
347 } 374 }
348 }, 375 },
376 +<<<<<<< HEAD
349 "node_modules/express/node_modules/qs": { 377 "node_modules/express/node_modules/qs": {
350 "version": "6.11.0", 378 "version": "6.11.0",
351 "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 379 "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
...@@ -386,6 +414,8 @@ ...@@ -386,6 +414,8 @@
386 }, 414 },
387 <<<<<<< HEAD 415 <<<<<<< HEAD
388 ======= 416 =======
417 +=======
418 +>>>>>>> bef06db (Init Address.js)
389 "node_modules/finalhandler": { 419 "node_modules/finalhandler": {
390 "version": "1.2.0", 420 "version": "1.2.0",
391 "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 421 "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
...@@ -403,6 +433,7 @@ ...@@ -403,6 +433,7 @@
403 "node": ">= 0.8" 433 "node": ">= 0.8"
404 } 434 }
405 }, 435 },
436 +<<<<<<< HEAD
406 >>>>>>> main 437 >>>>>>> main
407 "node_modules/forever-agent": { 438 "node_modules/forever-agent": {
408 "version": "0.6.1", 439 "version": "0.6.1",
...@@ -427,6 +458,8 @@ ...@@ -427,6 +458,8 @@
427 }, 458 },
428 <<<<<<< HEAD 459 <<<<<<< HEAD
429 ======= 460 =======
461 +=======
462 +>>>>>>> bef06db (Init Address.js)
430 "node_modules/forwarded": { 463 "node_modules/forwarded": {
431 "version": "0.2.0", 464 "version": "0.2.0",
432 "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 465 "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
...@@ -461,6 +494,7 @@ ...@@ -461,6 +494,7 @@
461 "url": "https://github.com/sponsors/ljharb" 494 "url": "https://github.com/sponsors/ljharb"
462 } 495 }
463 }, 496 },
497 +<<<<<<< HEAD
464 >>>>>>> main 498 >>>>>>> main
465 "node_modules/getpass": { 499 "node_modules/getpass": {
466 "version": "0.1.7", 500 "version": "0.1.7",
...@@ -493,6 +527,8 @@ ...@@ -493,6 +527,8 @@
493 }, 527 },
494 <<<<<<< HEAD 528 <<<<<<< HEAD
495 ======= 529 =======
530 +=======
531 +>>>>>>> bef06db (Init Address.js)
496 "node_modules/has": { 532 "node_modules/has": {
497 "version": "1.0.3", 533 "version": "1.0.3",
498 "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 534 "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
...@@ -530,6 +566,7 @@ ...@@ -530,6 +566,7 @@
530 "node": ">= 0.8" 566 "node": ">= 0.8"
531 } 567 }
532 }, 568 },
569 +<<<<<<< HEAD
533 >>>>>>> main 570 >>>>>>> main
534 "node_modules/http-signature": { 571 "node_modules/http-signature": {
535 "version": "1.2.0", 572 "version": "1.2.0",
...@@ -547,6 +584,8 @@ ...@@ -547,6 +584,8 @@
547 }, 584 },
548 <<<<<<< HEAD 585 <<<<<<< HEAD
549 ======= 586 =======
587 +=======
588 +>>>>>>> bef06db (Init Address.js)
550 "node_modules/iconv-lite": { 589 "node_modules/iconv-lite": {
551 "version": "0.4.24", 590 "version": "0.4.24",
552 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 591 "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
...@@ -571,6 +610,7 @@ ...@@ -571,6 +610,7 @@
571 "node": ">= 0.10" 610 "node": ">= 0.10"
572 } 611 }
573 }, 612 },
613 +<<<<<<< HEAD
574 >>>>>>> main 614 >>>>>>> main
575 "node_modules/is-typedarray": { 615 "node_modules/is-typedarray": {
576 "version": "1.0.0", 616 "version": "1.0.0",
...@@ -626,6 +666,8 @@ ...@@ -626,6 +666,8 @@
626 }, 666 },
627 <<<<<<< HEAD 667 <<<<<<< HEAD
628 ======= 668 =======
669 +=======
670 +>>>>>>> bef06db (Init Address.js)
629 "node_modules/media-typer": { 671 "node_modules/media-typer": {
630 "version": "0.3.0", 672 "version": "0.3.0",
631 "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 673 "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
...@@ -658,7 +700,10 @@ ...@@ -658,7 +700,10 @@
658 "node": ">=4" 700 "node": ">=4"
659 } 701 }
660 }, 702 },
703 +<<<<<<< HEAD
661 >>>>>>> main 704 >>>>>>> main
705 +=======
706 +>>>>>>> bef06db (Init Address.js)
662 "node_modules/mime-db": { 707 "node_modules/mime-db": {
663 "version": "1.52.0", 708 "version": "1.52.0",
664 "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 709 "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
...@@ -679,7 +724,10 @@ ...@@ -679,7 +724,10 @@
679 } 724 }
680 }, 725 },
681 <<<<<<< HEAD 726 <<<<<<< HEAD
727 +<<<<<<< HEAD
682 ======= 728 =======
729 +=======
730 +>>>>>>> bef06db (Init Address.js)
683 "node_modules/ms": { 731 "node_modules/ms": {
684 "version": "2.0.0", 732 "version": "2.0.0",
685 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 733 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
...@@ -693,6 +741,7 @@ ...@@ -693,6 +741,7 @@
693 "node": ">= 0.6" 741 "node": ">= 0.6"
694 } 742 }
695 }, 743 },
744 +<<<<<<< HEAD
696 "node_modules/node-fetch": { 745 "node_modules/node-fetch": {
697 "version": "2.6.7", 746 "version": "2.6.7",
698 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", 747 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
...@@ -737,6 +786,8 @@ ...@@ -737,6 +786,8 @@
737 }, 786 },
738 <<<<<<< HEAD 787 <<<<<<< HEAD
739 ======= 788 =======
789 +=======
790 +>>>>>>> bef06db (Init Address.js)
740 "node_modules/object-inspect": { 791 "node_modules/object-inspect": {
741 "version": "1.12.2", 792 "version": "1.12.2",
742 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", 793 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
...@@ -769,6 +820,7 @@ ...@@ -769,6 +820,7 @@
769 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 820 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
770 "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" 821 "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
771 }, 822 },
823 +<<<<<<< HEAD
772 >>>>>>> main 824 >>>>>>> main
773 "node_modules/performance-now": { 825 "node_modules/performance-now": {
774 "version": "2.1.0", 826 "version": "2.1.0",
...@@ -777,6 +829,8 @@ ...@@ -777,6 +829,8 @@
777 }, 829 },
778 <<<<<<< HEAD 830 <<<<<<< HEAD
779 ======= 831 =======
832 +=======
833 +>>>>>>> bef06db (Init Address.js)
780 "node_modules/proxy-addr": { 834 "node_modules/proxy-addr": {
781 "version": "2.0.7", 835 "version": "2.0.7",
782 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 836 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
...@@ -789,6 +843,7 @@ ...@@ -789,6 +843,7 @@
789 "node": ">= 0.10" 843 "node": ">= 0.10"
790 } 844 }
791 }, 845 },
846 +<<<<<<< HEAD
792 >>>>>>> main 847 >>>>>>> main
793 "node_modules/psl": { 848 "node_modules/psl": {
794 "version": "1.9.0", 849 "version": "1.9.0",
...@@ -813,6 +868,22 @@ ...@@ -813,6 +868,22 @@
813 }, 868 },
814 <<<<<<< HEAD 869 <<<<<<< HEAD
815 ======= 870 =======
871 +=======
872 + "node_modules/qs": {
873 + "version": "6.11.0",
874 + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
875 + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
876 + "dependencies": {
877 + "side-channel": "^1.0.4"
878 + },
879 + "engines": {
880 + "node": ">=0.6"
881 + },
882 + "funding": {
883 + "url": "https://github.com/sponsors/ljharb"
884 + }
885 + },
886 +>>>>>>> bef06db (Init Address.js)
816 "node_modules/range-parser": { 887 "node_modules/range-parser": {
817 "version": "1.2.1", 888 "version": "1.2.1",
818 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 889 "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
...@@ -835,6 +906,7 @@ ...@@ -835,6 +906,7 @@
835 "node": ">= 0.8" 906 "node": ">= 0.8"
836 } 907 }
837 }, 908 },
909 +<<<<<<< HEAD
838 >>>>>>> main 910 >>>>>>> main
839 "node_modules/request": { 911 "node_modules/request": {
840 "version": "2.88.2", 912 "version": "2.88.2",
...@@ -867,6 +939,8 @@ ...@@ -867,6 +939,8 @@
867 "node": ">= 6" 939 "node": ">= 6"
868 } 940 }
869 }, 941 },
942 +=======
943 +>>>>>>> bef06db (Init Address.js)
870 "node_modules/safe-buffer": { 944 "node_modules/safe-buffer": {
871 "version": "5.2.1", 945 "version": "5.2.1",
872 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 946 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
...@@ -892,12 +966,15 @@ ...@@ -892,12 +966,15 @@
892 "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 966 "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
893 }, 967 },
894 <<<<<<< HEAD 968 <<<<<<< HEAD
969 +<<<<<<< HEAD
895 ======= 970 =======
896 "node_modules/sax": { 971 "node_modules/sax": {
897 "version": "1.2.4", 972 "version": "1.2.4",
898 "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 973 "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
899 "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 974 "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
900 }, 975 },
976 +=======
977 +>>>>>>> bef06db (Init Address.js)
901 "node_modules/send": { 978 "node_modules/send": {
902 "version": "0.18.0", 979 "version": "0.18.0",
903 "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", 980 "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
...@@ -958,6 +1035,7 @@ ...@@ -958,6 +1035,7 @@
958 "url": "https://github.com/sponsors/ljharb" 1035 "url": "https://github.com/sponsors/ljharb"
959 } 1036 }
960 }, 1037 },
1038 +<<<<<<< HEAD
961 >>>>>>> main 1039 >>>>>>> main
962 "node_modules/sshpk": { 1040 "node_modules/sshpk": {
963 "version": "1.17.0", 1041 "version": "1.17.0",
...@@ -985,6 +1063,8 @@ ...@@ -985,6 +1063,8 @@
985 }, 1063 },
986 <<<<<<< HEAD 1064 <<<<<<< HEAD
987 ======= 1065 =======
1066 +=======
1067 +>>>>>>> bef06db (Init Address.js)
988 "node_modules/statuses": { 1068 "node_modules/statuses": {
989 "version": "2.0.1", 1069 "version": "2.0.1",
990 "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", 1070 "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
...@@ -1001,6 +1081,7 @@ ...@@ -1001,6 +1081,7 @@
1001 "node": ">=0.6" 1081 "node": ">=0.6"
1002 } 1082 }
1003 }, 1083 },
1084 +<<<<<<< HEAD
1004 >>>>>>> main 1085 >>>>>>> main
1005 "node_modules/tough-cookie": { 1086 "node_modules/tough-cookie": {
1006 "version": "2.5.0", 1087 "version": "2.5.0",
...@@ -1040,6 +1121,8 @@ ...@@ -1040,6 +1121,8 @@
1040 }, 1121 },
1041 <<<<<<< HEAD 1122 <<<<<<< HEAD
1042 ======= 1123 =======
1124 +=======
1125 +>>>>>>> bef06db (Init Address.js)
1043 "node_modules/type-is": { 1126 "node_modules/type-is": {
1044 "version": "1.6.18", 1127 "version": "1.6.18",
1045 "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 1128 "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
...@@ -1060,6 +1143,7 @@ ...@@ -1060,6 +1143,7 @@
1060 "node": ">= 0.8" 1143 "node": ">= 0.8"
1061 } 1144 }
1062 }, 1145 },
1146 +<<<<<<< HEAD
1063 >>>>>>> main 1147 >>>>>>> main
1064 "node_modules/uri-js": { 1148 "node_modules/uri-js": {
1065 "version": "4.4.1", 1149 "version": "4.4.1",
...@@ -1071,6 +1155,8 @@ ...@@ -1071,6 +1155,8 @@
1071 }, 1155 },
1072 <<<<<<< HEAD 1156 <<<<<<< HEAD
1073 ======= 1157 =======
1158 +=======
1159 +>>>>>>> bef06db (Init Address.js)
1074 "node_modules/utils-merge": { 1160 "node_modules/utils-merge": {
1075 "version": "1.0.1", 1161 "version": "1.0.1",
1076 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 1162 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
...@@ -1079,6 +1165,7 @@ ...@@ -1079,6 +1165,7 @@
1079 "node": ">= 0.4.0" 1165 "node": ">= 0.4.0"
1080 } 1166 }
1081 }, 1167 },
1168 +<<<<<<< HEAD
1082 >>>>>>> main 1169 >>>>>>> main
1083 "node_modules/uuid": { 1170 "node_modules/uuid": {
1084 "version": "3.4.0", 1171 "version": "3.4.0",
...@@ -1091,6 +1178,8 @@ ...@@ -1091,6 +1178,8 @@
1091 }, 1178 },
1092 <<<<<<< HEAD 1179 <<<<<<< HEAD
1093 ======= 1180 =======
1181 +=======
1182 +>>>>>>> bef06db (Init Address.js)
1094 "node_modules/vary": { 1183 "node_modules/vary": {
1095 "version": "1.1.2", 1184 "version": "1.1.2",
1096 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 1185 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
...@@ -1098,6 +1187,7 @@ ...@@ -1098,6 +1187,7 @@
1098 "engines": { 1187 "engines": {
1099 "node": ">= 0.8" 1188 "node": ">= 0.8"
1100 } 1189 }
1190 +<<<<<<< HEAD
1101 }, 1191 },
1102 >>>>>>> main 1192 >>>>>>> main
1103 "node_modules/verror": { 1193 "node_modules/verror": {
...@@ -1140,6 +1230,8 @@ ...@@ -1140,6 +1230,8 @@
1140 "xml-js": "bin/cli.js" 1230 "xml-js": "bin/cli.js"
1141 } 1231 }
1142 >>>>>>> main 1232 >>>>>>> main
1233 +=======
1234 +>>>>>>> bef06db (Init Address.js)
1143 } 1235 }
1144 } 1236 }
1145 } 1237 }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
13 "func-name-matching": 0, 13 "func-name-matching": 0,
14 "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], 14 "id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
15 "indent": [2, 4], 15 "indent": [2, 4],
16 +<<<<<<< HEAD
16 "max-lines-per-function": 0, 17 "max-lines-per-function": 0,
17 "max-params": [2, 12], 18 "max-params": [2, 12],
18 "max-statements": [2, 45], 19 "max-statements": [2, 45],
...@@ -20,6 +21,14 @@ ...@@ -20,6 +21,14 @@
20 "no-continue": 1, 21 "no-continue": 1,
21 "no-magic-numbers": 0, 22 "no-magic-numbers": 0,
22 "no-param-reassign": 1, 23 "no-param-reassign": 1,
24 +=======
25 + "max-lines-per-function": [2, { "max": 150 }],
26 + "max-params": [2, 16],
27 + "max-statements": [2, 53],
28 + "multiline-comment-style": 0,
29 + "no-continue": 1,
30 + "no-magic-numbers": 0,
31 +>>>>>>> bef06db (Init Address.js)
23 "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], 32 "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
24 }, 33 },
25 34
...@@ -27,10 +36,19 @@ ...@@ -27,10 +36,19 @@
27 { 36 {
28 "files": "test/**", 37 "files": "test/**",
29 "rules": { 38 "rules": {
39 +<<<<<<< HEAD
30 "max-lines-per-function": 0, 40 "max-lines-per-function": 0,
31 "max-statements": 0, 41 "max-statements": 0,
32 "no-extend-native": 0, 42 "no-extend-native": 0,
33 "function-paren-newline": 0, 43 "function-paren-newline": 0,
44 +=======
45 + "function-paren-newline": 0,
46 + "max-lines-per-function": 0,
47 + "max-statements": 0,
48 + "no-buffer-constructor": 0,
49 + "no-extend-native": 0,
50 + "no-throw-literal": 0,
51 +>>>>>>> bef06db (Init Address.js)
34 }, 52 },
35 }, 53 },
36 ], 54 ],
......
This diff is collapsed. Click to expand it.
1 +<<<<<<< HEAD
1 # qs <sup>[![Version Badge][2]][1]</sup> 2 # qs <sup>[![Version Badge][2]][1]</sup>
3 +=======
4 +# qs <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
5 +>>>>>>> bef06db (Init Address.js)
2 6
3 [![github actions][actions-image]][actions-url] 7 [![github actions][actions-image]][actions-url]
4 [![coverage][codecov-image]][codecov-url] 8 [![coverage][codecov-image]][codecov-url]
...@@ -147,6 +151,65 @@ var withDots = qs.parse('a.b=c', { allowDots: true }); ...@@ -147,6 +151,65 @@ var withDots = qs.parse('a.b=c', { allowDots: true });
147 assert.deepEqual(withDots, { a: { b: 'c' } }); 151 assert.deepEqual(withDots, { a: { b: 'c' } });
148 ``` 152 ```
149 153
154 +<<<<<<< HEAD
155 +=======
156 +If you have to deal with legacy browsers or services, there's
157 +also support for decoding percent-encoded octets as iso-8859-1:
158 +
159 +```javascript
160 +var oldCharset = qs.parse('a=%A7', { charset: 'iso-8859-1' });
161 +assert.deepEqual(oldCharset, { a: '§' });
162 +```
163 +
164 +Some services add an initial `utf8=✓` value to forms so that old
165 +Internet Explorer versions are more likely to submit the form as
166 +utf-8. Additionally, the server can check the value against wrong
167 +encodings of the checkmark character and detect that a query string
168 +or `application/x-www-form-urlencoded` body was *not* sent as
169 +utf-8, eg. if the form had an `accept-charset` parameter or the
170 +containing page had a different character set.
171 +
172 +**qs** supports this mechanism via the `charsetSentinel` option.
173 +If specified, the `utf8` parameter will be omitted from the
174 +returned object. It will be used to switch to `iso-8859-1`/`utf-8`
175 +mode depending on how the checkmark is encoded.
176 +
177 +**Important**: When you specify both the `charset` option and the
178 +`charsetSentinel` option, the `charset` will be overridden when
179 +the request contains a `utf8` parameter from which the actual
180 +charset can be deduced. In that sense the `charset` will behave
181 +as the default charset rather than the authoritative charset.
182 +
183 +```javascript
184 +var detectedAsUtf8 = qs.parse('utf8=%E2%9C%93&a=%C3%B8', {
185 + charset: 'iso-8859-1',
186 + charsetSentinel: true
187 +});
188 +assert.deepEqual(detectedAsUtf8, { a: 'ø' });
189 +
190 +// Browsers encode the checkmark as &#10003; when submitting as iso-8859-1:
191 +var detectedAsIso8859_1 = qs.parse('utf8=%26%2310003%3B&a=%F8', {
192 + charset: 'utf-8',
193 + charsetSentinel: true
194 +});
195 +assert.deepEqual(detectedAsIso8859_1, { a: 'ø' });
196 +```
197 +
198 +If you want to decode the `&#...;` syntax to the actual character,
199 +you can specify the `interpretNumericEntities` option as well:
200 +
201 +```javascript
202 +var detectedAsIso8859_1 = qs.parse('a=%26%239786%3B', {
203 + charset: 'iso-8859-1',
204 + interpretNumericEntities: true
205 +});
206 +assert.deepEqual(detectedAsIso8859_1, { a: '☺' });
207 +```
208 +
209 +It also works when the charset has been detected in `charsetSentinel`
210 +mode.
211 +
212 +>>>>>>> bef06db (Init Address.js)
150 ### Parsing Arrays 213 ### Parsing Arrays
151 214
152 **qs** can also parse arrays using a similar `[]` notation: 215 **qs** can also parse arrays using a similar `[]` notation:
...@@ -172,6 +235,16 @@ var noSparse = qs.parse('a[1]=b&a[15]=c'); ...@@ -172,6 +235,16 @@ var noSparse = qs.parse('a[1]=b&a[15]=c');
172 assert.deepEqual(noSparse, { a: ['b', 'c'] }); 235 assert.deepEqual(noSparse, { a: ['b', 'c'] });
173 ``` 236 ```
174 237
238 +<<<<<<< HEAD
239 +=======
240 +You may also use `allowSparse` option to parse sparse arrays:
241 +
242 +```javascript
243 +var sparseArray = qs.parse('a[1]=2&a[3]=5', { allowSparse: true });
244 +assert.deepEqual(sparseArray, { a: [, '2', , '5'] });
245 +```
246 +
247 +>>>>>>> bef06db (Init Address.js)
175 Note that an empty string is also a value, and will be preserved: 248 Note that an empty string is also a value, and will be preserved:
176 249
177 ```javascript 250 ```javascript
...@@ -218,6 +291,27 @@ var arraysOfObjects = qs.parse('a[][b]=c'); ...@@ -218,6 +291,27 @@ var arraysOfObjects = qs.parse('a[][b]=c');
218 assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); 291 assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] });
219 ``` 292 ```
220 293
294 +<<<<<<< HEAD
295 +=======
296 +Some people use comma to join array, **qs** can parse it:
297 +```javascript
298 +var arraysOfObjects = qs.parse('a=b,c', { comma: true })
299 +assert.deepEqual(arraysOfObjects, { a: ['b', 'c'] })
300 +```
301 +(_this cannot convert nested objects, such as `a={b:1},{c:d}`_)
302 +
303 +### Parsing primitive/scalar values (numbers, booleans, null, etc)
304 +
305 +By default, all values are parsed as strings. This behavior will not change and is explained in [issue #91](https://github.com/ljharb/qs/issues/91).
306 +
307 +```javascript
308 +var primitiveValues = qs.parse('a=15&b=true&c=null');
309 +assert.deepEqual(primitiveValues, { a: '15', b: 'true', c: 'null' });
310 +```
311 +
312 +If you wish to auto-convert values which look like numbers, booleans, and other values into their primitive counterparts, you can use the [query-types Express JS middleware](https://github.com/xpepermint/query-types) which will auto-convert all request query parameters.
313 +
314 +>>>>>>> bef06db (Init Address.js)
221 ### Stringifying 315 ### Stringifying
222 316
223 [](#preventEval) 317 [](#preventEval)
...@@ -317,8 +411,17 @@ qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) ...@@ -317,8 +411,17 @@ qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' })
317 // 'a[]=b&a[]=c' 411 // 'a[]=b&a[]=c'
318 qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) 412 qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' })
319 // 'a=b&a=c' 413 // 'a=b&a=c'
414 +<<<<<<< HEAD
320 ``` 415 ```
321 416
417 +=======
418 +qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' })
419 +// 'a=b,c'
420 +```
421 +
422 +Note: when using `arrayFormat` set to `'comma'`, you can also pass the `commaRoundTrip` option set to `true` or `false`, to append `[]` on single-item arrays, so that they can round trip through a parse.
423 +
424 +>>>>>>> bef06db (Init Address.js)
322 When objects are stringified, by default they use bracket notation: 425 When objects are stringified, by default they use bracket notation:
323 426
324 ```javascript 427 ```javascript
...@@ -451,10 +554,47 @@ var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); ...@@ -451,10 +554,47 @@ var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true });
451 assert.equal(nullsSkipped, 'a=b'); 554 assert.equal(nullsSkipped, 'a=b');
452 ``` 555 ```
453 556
557 +<<<<<<< HEAD
454 ### Dealing with special character sets 558 ### Dealing with special character sets
455 559
456 By default the encoding and decoding of characters is done in `utf-8`. If you 560 By default the encoding and decoding of characters is done in `utf-8`. If you
457 wish to encode querystrings to a different character set (i.e. 561 wish to encode querystrings to a different character set (i.e.
562 +=======
563 +If you're communicating with legacy systems, you can switch to `iso-8859-1`
564 +using the `charset` option:
565 +
566 +```javascript
567 +var iso = qs.stringify({ æ: 'æ' }, { charset: 'iso-8859-1' });
568 +assert.equal(iso, '%E6=%E6');
569 +```
570 +
571 +Characters that don't exist in `iso-8859-1` will be converted to numeric
572 +entities, similar to what browsers do:
573 +
574 +```javascript
575 +var numeric = qs.stringify({ a: '☺' }, { charset: 'iso-8859-1' });
576 +assert.equal(numeric, 'a=%26%239786%3B');
577 +```
578 +
579 +You can use the `charsetSentinel` option to announce the character by
580 +including an `utf8=✓` parameter with the proper encoding if the checkmark,
581 +similar to what Ruby on Rails and others do when submitting forms.
582 +
583 +```javascript
584 +var sentinel = qs.stringify({ a: '☺' }, { charsetSentinel: true });
585 +assert.equal(sentinel, 'utf8=%E2%9C%93&a=%E2%98%BA');
586 +
587 +var isoSentinel = qs.stringify({ a: 'æ' }, { charsetSentinel: true, charset: 'iso-8859-1' });
588 +assert.equal(isoSentinel, 'utf8=%26%2310003%3B&a=%E6');
589 +```
590 +
591 +### Dealing with special character sets
592 +
593 +By default the encoding and decoding of characters is done in `utf-8`,
594 +and `iso-8859-1` support is also built in via the `charset` parameter.
595 +
596 +If you wish to encode querystrings to a different character set (i.e.
597 +>>>>>>> bef06db (Init Address.js)
458 [Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the 598 [Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the
459 [`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library: 599 [`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library:
460 600
......
This diff is collapsed. Click to expand it.
...@@ -3,8 +3,18 @@ ...@@ -3,8 +3,18 @@
3 var replace = String.prototype.replace; 3 var replace = String.prototype.replace;
4 var percentTwenties = /%20/g; 4 var percentTwenties = /%20/g;
5 5
6 +<<<<<<< HEAD
6 module.exports = { 7 module.exports = {
7 'default': 'RFC3986', 8 'default': 'RFC3986',
9 +=======
10 +var Format = {
11 + RFC1738: 'RFC1738',
12 + RFC3986: 'RFC3986'
13 +};
14 +
15 +module.exports = {
16 + 'default': Format.RFC3986,
17 +>>>>>>> bef06db (Init Address.js)
8 formatters: { 18 formatters: {
9 RFC1738: function (value) { 19 RFC1738: function (value) {
10 return replace.call(value, percentTwenties, '+'); 20 return replace.call(value, percentTwenties, '+');
...@@ -13,6 +23,11 @@ module.exports = { ...@@ -13,6 +23,11 @@ module.exports = {
13 return String(value); 23 return String(value);
14 } 24 }
15 }, 25 },
26 +<<<<<<< HEAD
16 RFC1738: 'RFC1738', 27 RFC1738: 'RFC1738',
17 RFC3986: 'RFC3986' 28 RFC3986: 'RFC3986'
29 +=======
30 + RFC1738: Format.RFC1738,
31 + RFC3986: Format.RFC3986
32 +>>>>>>> bef06db (Init Address.js)
18 }; 33 };
......
...@@ -3,26 +3,97 @@ ...@@ -3,26 +3,97 @@
3 var utils = require('./utils'); 3 var utils = require('./utils');
4 4
5 var has = Object.prototype.hasOwnProperty; 5 var has = Object.prototype.hasOwnProperty;
6 +<<<<<<< HEAD
7 +=======
8 +var isArray = Array.isArray;
9 +>>>>>>> bef06db (Init Address.js)
6 10
7 var defaults = { 11 var defaults = {
8 allowDots: false, 12 allowDots: false,
9 allowPrototypes: false, 13 allowPrototypes: false,
14 +<<<<<<< HEAD
10 arrayLimit: 20, 15 arrayLimit: 20,
11 decoder: utils.decode, 16 decoder: utils.decode,
12 delimiter: '&', 17 delimiter: '&',
13 depth: 5, 18 depth: 5,
14 parameterLimit: 1000, 19 parameterLimit: 1000,
20 +=======
21 + allowSparse: false,
22 + arrayLimit: 20,
23 + charset: 'utf-8',
24 + charsetSentinel: false,
25 + comma: false,
26 + decoder: utils.decode,
27 + delimiter: '&',
28 + depth: 5,
29 + ignoreQueryPrefix: false,
30 + interpretNumericEntities: false,
31 + parameterLimit: 1000,
32 + parseArrays: true,
33 +>>>>>>> bef06db (Init Address.js)
15 plainObjects: false, 34 plainObjects: false,
16 strictNullHandling: false 35 strictNullHandling: false
17 }; 36 };
18 37
38 +<<<<<<< HEAD
39 +=======
40 +var interpretNumericEntities = function (str) {
41 + return str.replace(/&#(\d+);/g, function ($0, numberStr) {
42 + return String.fromCharCode(parseInt(numberStr, 10));
43 + });
44 +};
45 +
46 +var parseArrayValue = function (val, options) {
47 + if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
48 + return val.split(',');
49 + }
50 +
51 + return val;
52 +};
53 +
54 +// This is what browsers will submit when the ✓ character occurs in an
55 +// application/x-www-form-urlencoded body and the encoding of the page containing
56 +// the form is iso-8859-1, or when the submitted form has an accept-charset
57 +// attribute of iso-8859-1. Presumably also with other charsets that do not contain
58 +// the ✓ character, such as us-ascii.
59 +var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
60 +
61 +// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
62 +var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
63 +
64 +>>>>>>> bef06db (Init Address.js)
19 var parseValues = function parseQueryStringValues(str, options) { 65 var parseValues = function parseQueryStringValues(str, options) {
20 var obj = {}; 66 var obj = {};
21 var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; 67 var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
22 var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; 68 var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
23 var parts = cleanStr.split(options.delimiter, limit); 69 var parts = cleanStr.split(options.delimiter, limit);
70 +<<<<<<< HEAD
24 71
25 for (var i = 0; i < parts.length; ++i) { 72 for (var i = 0; i < parts.length; ++i) {
73 +=======
74 + var skipIndex = -1; // Keep track of where the utf8 sentinel was found
75 + var i;
76 +
77 + var charset = options.charset;
78 + if (options.charsetSentinel) {
79 + for (i = 0; i < parts.length; ++i) {
80 + if (parts[i].indexOf('utf8=') === 0) {
81 + if (parts[i] === charsetSentinel) {
82 + charset = 'utf-8';
83 + } else if (parts[i] === isoSentinel) {
84 + charset = 'iso-8859-1';
85 + }
86 + skipIndex = i;
87 + i = parts.length; // The eslint settings do not allow break;
88 + }
89 + }
90 + }
91 +
92 + for (i = 0; i < parts.length; ++i) {
93 + if (i === skipIndex) {
94 + continue;
95 + }
96 +>>>>>>> bef06db (Init Address.js)
26 var part = parts[i]; 97 var part = parts[i];
27 98
28 var bracketEqualsPos = part.indexOf(']='); 99 var bracketEqualsPos = part.indexOf(']=');
...@@ -30,6 +101,7 @@ var parseValues = function parseQueryStringValues(str, options) { ...@@ -30,6 +101,7 @@ var parseValues = function parseQueryStringValues(str, options) {
30 101
31 var key, val; 102 var key, val;
32 if (pos === -1) { 103 if (pos === -1) {
104 +<<<<<<< HEAD
33 key = options.decoder(part, defaults.decoder); 105 key = options.decoder(part, defaults.decoder);
34 val = options.strictNullHandling ? null : ''; 106 val = options.strictNullHandling ? null : '';
35 } else { 107 } else {
...@@ -38,6 +110,30 @@ var parseValues = function parseQueryStringValues(str, options) { ...@@ -38,6 +110,30 @@ var parseValues = function parseQueryStringValues(str, options) {
38 } 110 }
39 if (has.call(obj, key)) { 111 if (has.call(obj, key)) {
40 obj[key] = [].concat(obj[key]).concat(val); 112 obj[key] = [].concat(obj[key]).concat(val);
113 +=======
114 + key = options.decoder(part, defaults.decoder, charset, 'key');
115 + val = options.strictNullHandling ? null : '';
116 + } else {
117 + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
118 + val = utils.maybeMap(
119 + parseArrayValue(part.slice(pos + 1), options),
120 + function (encodedVal) {
121 + return options.decoder(encodedVal, defaults.decoder, charset, 'value');
122 + }
123 + );
124 + }
125 +
126 + if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
127 + val = interpretNumericEntities(val);
128 + }
129 +
130 + if (part.indexOf('[]=') > -1) {
131 + val = isArray(val) ? [val] : val;
132 + }
133 +
134 + if (has.call(obj, key)) {
135 + obj[key] = utils.combine(obj[key], val);
136 +>>>>>>> bef06db (Init Address.js)
41 } else { 137 } else {
42 obj[key] = val; 138 obj[key] = val;
43 } 139 }
...@@ -46,8 +142,13 @@ var parseValues = function parseQueryStringValues(str, options) { ...@@ -46,8 +142,13 @@ var parseValues = function parseQueryStringValues(str, options) {
46 return obj; 142 return obj;
47 }; 143 };
48 144
145 +<<<<<<< HEAD
49 var parseObject = function (chain, val, options) { 146 var parseObject = function (chain, val, options) {
50 var leaf = val; 147 var leaf = val;
148 +=======
149 +var parseObject = function (chain, val, options, valuesParsed) {
150 + var leaf = valuesParsed ? val : parseArrayValue(val, options);
151 +>>>>>>> bef06db (Init Address.js)
51 152
52 for (var i = chain.length - 1; i >= 0; --i) { 153 for (var i = chain.length - 1; i >= 0; --i) {
53 var obj; 154 var obj;
...@@ -81,7 +182,11 @@ var parseObject = function (chain, val, options) { ...@@ -81,7 +182,11 @@ var parseObject = function (chain, val, options) {
81 return leaf; 182 return leaf;
82 }; 183 };
83 184
185 +<<<<<<< HEAD
84 var parseKeys = function parseQueryStringKeys(givenKey, val, options) { 186 var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
187 +=======
188 +var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
189 +>>>>>>> bef06db (Init Address.js)
85 if (!givenKey) { 190 if (!givenKey) {
86 return; 191 return;
87 } 192 }
...@@ -96,15 +201,23 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) { ...@@ -96,15 +201,23 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
96 201
97 // Get the parent 202 // Get the parent
98 203
204 +<<<<<<< HEAD
99 var segment = brackets.exec(key); 205 var segment = brackets.exec(key);
206 +=======
207 + var segment = options.depth > 0 && brackets.exec(key);
208 +>>>>>>> bef06db (Init Address.js)
100 var parent = segment ? key.slice(0, segment.index) : key; 209 var parent = segment ? key.slice(0, segment.index) : key;
101 210
102 // Stash the parent if it exists 211 // Stash the parent if it exists
103 212
104 var keys = []; 213 var keys = [];
105 if (parent) { 214 if (parent) {
215 +<<<<<<< HEAD
106 // If we aren't using plain objects, optionally prefix keys 216 // If we aren't using plain objects, optionally prefix keys
107 // that would overwrite object prototype properties 217 // that would overwrite object prototype properties
218 +=======
219 + // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
220 +>>>>>>> bef06db (Init Address.js)
108 if (!options.plainObjects && has.call(Object.prototype, parent)) { 221 if (!options.plainObjects && has.call(Object.prototype, parent)) {
109 if (!options.allowPrototypes) { 222 if (!options.allowPrototypes) {
110 return; 223 return;
...@@ -117,7 +230,11 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) { ...@@ -117,7 +230,11 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
117 // Loop through children appending to the array until we hit depth 230 // Loop through children appending to the array until we hit depth
118 231
119 var i = 0; 232 var i = 0;
233 +<<<<<<< HEAD
120 while ((segment = child.exec(key)) !== null && i < options.depth) { 234 while ((segment = child.exec(key)) !== null && i < options.depth) {
235 +=======
236 + while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
237 +>>>>>>> bef06db (Init Address.js)
121 i += 1; 238 i += 1;
122 if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { 239 if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
123 if (!options.allowPrototypes) { 240 if (!options.allowPrototypes) {
...@@ -133,6 +250,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) { ...@@ -133,6 +250,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
133 keys.push('[' + key.slice(segment.index) + ']'); 250 keys.push('[' + key.slice(segment.index) + ']');
134 } 251 }
135 252
253 +<<<<<<< HEAD
136 return parseObject(keys, val, options); 254 return parseObject(keys, val, options);
137 }; 255 };
138 256
...@@ -154,6 +272,48 @@ module.exports = function (str, opts) { ...@@ -154,6 +272,48 @@ module.exports = function (str, opts) {
154 options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes; 272 options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;
155 options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit; 273 options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;
156 options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling; 274 options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
275 +=======
276 + return parseObject(keys, val, options, valuesParsed);
277 +};
278 +
279 +var normalizeParseOptions = function normalizeParseOptions(opts) {
280 + if (!opts) {
281 + return defaults;
282 + }
283 +
284 + if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
285 + throw new TypeError('Decoder has to be a function.');
286 + }
287 +
288 + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
289 + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
290 + }
291 + var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
292 +
293 + return {
294 + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
295 + allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
296 + allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
297 + arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
298 + charset: charset,
299 + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
300 + comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
301 + decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
302 + delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
303 + // eslint-disable-next-line no-implicit-coercion, no-extra-parens
304 + depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
305 + ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
306 + interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
307 + parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
308 + parseArrays: opts.parseArrays !== false,
309 + plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
310 + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
311 + };
312 +};
313 +
314 +module.exports = function (str, opts) {
315 + var options = normalizeParseOptions(opts);
316 +>>>>>>> bef06db (Init Address.js)
157 317
158 if (str === '' || str === null || typeof str === 'undefined') { 318 if (str === '' || str === null || typeof str === 'undefined') {
159 return options.plainObjects ? Object.create(null) : {}; 319 return options.plainObjects ? Object.create(null) : {};
...@@ -167,9 +327,20 @@ module.exports = function (str, opts) { ...@@ -167,9 +327,20 @@ module.exports = function (str, opts) {
167 var keys = Object.keys(tempObj); 327 var keys = Object.keys(tempObj);
168 for (var i = 0; i < keys.length; ++i) { 328 for (var i = 0; i < keys.length; ++i) {
169 var key = keys[i]; 329 var key = keys[i];
330 +<<<<<<< HEAD
170 var newObj = parseKeys(key, tempObj[key], options); 331 var newObj = parseKeys(key, tempObj[key], options);
171 obj = utils.merge(obj, newObj, options); 332 obj = utils.merge(obj, newObj, options);
172 } 333 }
173 334
335 +=======
336 + var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
337 + obj = utils.merge(obj, newObj, options);
338 + }
339 +
340 + if (options.allowSparse === true) {
341 + return obj;
342 + }
343 +
344 +>>>>>>> bef06db (Init Address.js)
174 return utils.compact(obj); 345 return utils.compact(obj);
175 }; 346 };
......
This diff is collapsed. Click to expand it.
1 'use strict'; 1 'use strict';
2 2
3 +<<<<<<< HEAD
3 var has = Object.prototype.hasOwnProperty; 4 var has = Object.prototype.hasOwnProperty;
5 +=======
6 +var formats = require('./formats');
7 +
8 +var has = Object.prototype.hasOwnProperty;
9 +var isArray = Array.isArray;
10 +>>>>>>> bef06db (Init Address.js)
4 11
5 var hexTable = (function () { 12 var hexTable = (function () {
6 var array = []; 13 var array = [];
...@@ -12,6 +19,7 @@ var hexTable = (function () { ...@@ -12,6 +19,7 @@ var hexTable = (function () {
12 }()); 19 }());
13 20
14 var compactQueue = function compactQueue(queue) { 21 var compactQueue = function compactQueue(queue) {
22 +<<<<<<< HEAD
15 var obj; 23 var obj;
16 24
17 while (queue.length) { 25 while (queue.length) {
...@@ -19,6 +27,13 @@ var compactQueue = function compactQueue(queue) { ...@@ -19,6 +27,13 @@ var compactQueue = function compactQueue(queue) {
19 obj = item.obj[item.prop]; 27 obj = item.obj[item.prop];
20 28
21 if (Array.isArray(obj)) { 29 if (Array.isArray(obj)) {
30 +=======
31 + while (queue.length > 1) {
32 + var item = queue.pop();
33 + var obj = item.obj[item.prop];
34 +
35 + if (isArray(obj)) {
36 +>>>>>>> bef06db (Init Address.js)
22 var compacted = []; 37 var compacted = [];
23 38
24 for (var j = 0; j < obj.length; ++j) { 39 for (var j = 0; j < obj.length; ++j) {
...@@ -30,8 +45,11 @@ var compactQueue = function compactQueue(queue) { ...@@ -30,8 +45,11 @@ var compactQueue = function compactQueue(queue) {
30 item.obj[item.prop] = compacted; 45 item.obj[item.prop] = compacted;
31 } 46 }
32 } 47 }
48 +<<<<<<< HEAD
33 49
34 return obj; 50 return obj;
51 +=======
52 +>>>>>>> bef06db (Init Address.js)
35 }; 53 };
36 54
37 var arrayToObject = function arrayToObject(source, options) { 55 var arrayToObject = function arrayToObject(source, options) {
...@@ -46,12 +64,20 @@ var arrayToObject = function arrayToObject(source, options) { ...@@ -46,12 +64,20 @@ var arrayToObject = function arrayToObject(source, options) {
46 }; 64 };
47 65
48 var merge = function merge(target, source, options) { 66 var merge = function merge(target, source, options) {
67 +<<<<<<< HEAD
68 +=======
69 + /* eslint no-param-reassign: 0 */
70 +>>>>>>> bef06db (Init Address.js)
49 if (!source) { 71 if (!source) {
50 return target; 72 return target;
51 } 73 }
52 74
53 if (typeof source !== 'object') { 75 if (typeof source !== 'object') {
76 +<<<<<<< HEAD
54 if (Array.isArray(target)) { 77 if (Array.isArray(target)) {
78 +=======
79 + if (isArray(target)) {
80 +>>>>>>> bef06db (Init Address.js)
55 target.push(source); 81 target.push(source);
56 } else if (target && typeof target === 'object') { 82 } else if (target && typeof target === 'object') {
57 if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { 83 if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
...@@ -69,11 +95,19 @@ var merge = function merge(target, source, options) { ...@@ -69,11 +95,19 @@ var merge = function merge(target, source, options) {
69 } 95 }
70 96
71 var mergeTarget = target; 97 var mergeTarget = target;
98 +<<<<<<< HEAD
72 if (Array.isArray(target) && !Array.isArray(source)) { 99 if (Array.isArray(target) && !Array.isArray(source)) {
73 mergeTarget = arrayToObject(target, options); 100 mergeTarget = arrayToObject(target, options);
74 } 101 }
75 102
76 if (Array.isArray(target) && Array.isArray(source)) { 103 if (Array.isArray(target) && Array.isArray(source)) {
104 +=======
105 + if (isArray(target) && !isArray(source)) {
106 + mergeTarget = arrayToObject(target, options);
107 + }
108 +
109 + if (isArray(target) && isArray(source)) {
110 +>>>>>>> bef06db (Init Address.js)
77 source.forEach(function (item, i) { 111 source.forEach(function (item, i) {
78 if (has.call(target, i)) { 112 if (has.call(target, i)) {
79 var targetItem = target[i]; 113 var targetItem = target[i];
...@@ -108,6 +142,7 @@ var assign = function assignSingleSource(target, source) { ...@@ -108,6 +142,7 @@ var assign = function assignSingleSource(target, source) {
108 }, target); 142 }, target);
109 }; 143 };
110 144
145 +<<<<<<< HEAD
111 var decode = function (str) { 146 var decode = function (str) {
112 try { 147 try {
113 return decodeURIComponent(str.replace(/\+/g, ' ')); 148 return decodeURIComponent(str.replace(/\+/g, ' '));
...@@ -117,13 +152,45 @@ var decode = function (str) { ...@@ -117,13 +152,45 @@ var decode = function (str) {
117 }; 152 };
118 153
119 var encode = function encode(str) { 154 var encode = function encode(str) {
155 +=======
156 +var decode = function (str, decoder, charset) {
157 + var strWithoutPlus = str.replace(/\+/g, ' ');
158 + if (charset === 'iso-8859-1') {
159 + // unescape never throws, no try...catch needed:
160 + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
161 + }
162 + // utf-8
163 + try {
164 + return decodeURIComponent(strWithoutPlus);
165 + } catch (e) {
166 + return strWithoutPlus;
167 + }
168 +};
169 +
170 +var encode = function encode(str, defaultEncoder, charset, kind, format) {
171 +>>>>>>> bef06db (Init Address.js)
120 // This code was originally written by Brian White (mscdex) for the io.js core querystring library. 172 // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
121 // It has been adapted here for stricter adherence to RFC 3986 173 // It has been adapted here for stricter adherence to RFC 3986
122 if (str.length === 0) { 174 if (str.length === 0) {
123 return str; 175 return str;
124 } 176 }
125 177
178 +<<<<<<< HEAD
126 var string = typeof str === 'string' ? str : String(str); 179 var string = typeof str === 'string' ? str : String(str);
180 +=======
181 + var string = str;
182 + if (typeof str === 'symbol') {
183 + string = Symbol.prototype.toString.call(str);
184 + } else if (typeof str !== 'string') {
185 + string = String(str);
186 + }
187 +
188 + if (charset === 'iso-8859-1') {
189 + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
190 + return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
191 + });
192 + }
193 +>>>>>>> bef06db (Init Address.js)
127 194
128 var out = ''; 195 var out = '';
129 for (var i = 0; i < string.length; ++i) { 196 for (var i = 0; i < string.length; ++i) {
...@@ -137,6 +204,10 @@ var encode = function encode(str) { ...@@ -137,6 +204,10 @@ var encode = function encode(str) {
137 || (c >= 0x30 && c <= 0x39) // 0-9 204 || (c >= 0x30 && c <= 0x39) // 0-9
138 || (c >= 0x41 && c <= 0x5A) // a-z 205 || (c >= 0x41 && c <= 0x5A) // a-z
139 || (c >= 0x61 && c <= 0x7A) // A-Z 206 || (c >= 0x61 && c <= 0x7A) // A-Z
207 +<<<<<<< HEAD
208 +=======
209 + || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
210 +>>>>>>> bef06db (Init Address.js)
140 ) { 211 ) {
141 out += string.charAt(i); 212 out += string.charAt(i);
142 continue; 213 continue;
...@@ -188,7 +259,13 @@ var compact = function compact(value) { ...@@ -188,7 +259,13 @@ var compact = function compact(value) {
188 } 259 }
189 } 260 }
190 261
262 +<<<<<<< HEAD
191 return compactQueue(queue); 263 return compactQueue(queue);
264 +=======
265 + compactQueue(queue);
266 +
267 + return value;
268 +>>>>>>> bef06db (Init Address.js)
192 }; 269 };
193 270
194 var isRegExp = function isRegExp(obj) { 271 var isRegExp = function isRegExp(obj) {
...@@ -196,20 +273,50 @@ var isRegExp = function isRegExp(obj) { ...@@ -196,20 +273,50 @@ var isRegExp = function isRegExp(obj) {
196 }; 273 };
197 274
198 var isBuffer = function isBuffer(obj) { 275 var isBuffer = function isBuffer(obj) {
276 +<<<<<<< HEAD
199 if (obj === null || typeof obj === 'undefined') { 277 if (obj === null || typeof obj === 'undefined') {
278 +=======
279 + if (!obj || typeof obj !== 'object') {
280 +>>>>>>> bef06db (Init Address.js)
200 return false; 281 return false;
201 } 282 }
202 283
203 return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); 284 return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
204 }; 285 };
205 286
287 +<<<<<<< HEAD
288 +module.exports = {
289 + arrayToObject: arrayToObject,
290 + assign: assign,
291 +=======
292 +var combine = function combine(a, b) {
293 + return [].concat(a, b);
294 +};
295 +
296 +var maybeMap = function maybeMap(val, fn) {
297 + if (isArray(val)) {
298 + var mapped = [];
299 + for (var i = 0; i < val.length; i += 1) {
300 + mapped.push(fn(val[i]));
301 + }
302 + return mapped;
303 + }
304 + return fn(val);
305 +};
306 +
206 module.exports = { 307 module.exports = {
207 arrayToObject: arrayToObject, 308 arrayToObject: arrayToObject,
208 assign: assign, 309 assign: assign,
310 + combine: combine,
311 +>>>>>>> bef06db (Init Address.js)
209 compact: compact, 312 compact: compact,
210 decode: decode, 313 decode: decode,
211 encode: encode, 314 encode: encode,
212 isBuffer: isBuffer, 315 isBuffer: isBuffer,
213 isRegExp: isRegExp, 316 isRegExp: isRegExp,
317 +<<<<<<< HEAD
318 +=======
319 + maybeMap: maybeMap,
320 +>>>>>>> bef06db (Init Address.js)
214 merge: merge 321 merge: merge
215 }; 322 };
......
...@@ -2,11 +2,21 @@ ...@@ -2,11 +2,21 @@
2 "name": "qs", 2 "name": "qs",
3 "description": "A querystring parser that supports nesting and arrays, with a depth limit", 3 "description": "A querystring parser that supports nesting and arrays, with a depth limit",
4 "homepage": "https://github.com/ljharb/qs", 4 "homepage": "https://github.com/ljharb/qs",
5 +<<<<<<< HEAD
5 "version": "6.5.3", 6 "version": "6.5.3",
7 +=======
8 + "version": "6.11.0",
9 +>>>>>>> bef06db (Init Address.js)
6 "repository": { 10 "repository": {
7 "type": "git", 11 "type": "git",
8 "url": "https://github.com/ljharb/qs.git" 12 "url": "https://github.com/ljharb/qs.git"
9 }, 13 },
14 +<<<<<<< HEAD
15 +=======
16 + "funding": {
17 + "url": "https://github.com/sponsors/ljharb"
18 + },
19 +>>>>>>> bef06db (Init Address.js)
10 "main": "lib/index.js", 20 "main": "lib/index.js",
11 "contributors": [ 21 "contributors": [
12 { 22 {
...@@ -17,11 +27,20 @@ ...@@ -17,11 +27,20 @@
17 ], 27 ],
18 "keywords": [ 28 "keywords": [
19 "querystring", 29 "querystring",
30 +<<<<<<< HEAD
20 "qs" 31 "qs"
32 +=======
33 + "qs",
34 + "query",
35 + "url",
36 + "parse",
37 + "stringify"
38 +>>>>>>> bef06db (Init Address.js)
21 ], 39 ],
22 "engines": { 40 "engines": {
23 "node": ">=0.6" 41 "node": ">=0.6"
24 }, 42 },
43 +<<<<<<< HEAD
25 "devDependencies": { 44 "devDependencies": {
26 "@ljharb/eslint-config": "^20.1.0", 45 "@ljharb/eslint-config": "^20.1.0",
27 "aud": "^1.1.5", 46 "aud": "^1.1.5",
...@@ -51,4 +70,51 @@ ...@@ -51,4 +70,51 @@
51 "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js" 70 "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js"
52 }, 71 },
53 "license": "BSD-3-Clause" 72 "license": "BSD-3-Clause"
73 +=======
74 + "dependencies": {
75 + "side-channel": "^1.0.4"
76 + },
77 + "devDependencies": {
78 + "@ljharb/eslint-config": "^21.0.0",
79 + "aud": "^2.0.0",
80 + "browserify": "^16.5.2",
81 + "eclint": "^2.8.1",
82 + "eslint": "=8.8.0",
83 + "evalmd": "^0.0.19",
84 + "for-each": "^0.3.3",
85 + "has-symbols": "^1.0.3",
86 + "iconv-lite": "^0.5.1",
87 + "in-publish": "^2.0.1",
88 + "mkdirp": "^0.5.5",
89 + "npmignore": "^0.3.0",
90 + "nyc": "^10.3.2",
91 + "object-inspect": "^1.12.2",
92 + "qs-iconv": "^1.0.4",
93 + "safe-publish-latest": "^2.0.0",
94 + "safer-buffer": "^2.1.2",
95 + "tape": "^5.5.3"
96 + },
97 + "scripts": {
98 + "prepack": "npmignore --auto --commentLines=autogenerated",
99 + "prepublishOnly": "safe-publish-latest && npm run dist",
100 + "prepublish": "not-in-publish || npm run prepublishOnly",
101 + "pretest": "npm run --silent readme && npm run --silent lint",
102 + "test": "npm run tests-only",
103 + "tests-only": "nyc tape 'test/**/*.js'",
104 + "posttest": "aud --production",
105 + "readme": "evalmd README.md",
106 + "postlint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)",
107 + "lint": "eslint --ext=js,mjs .",
108 + "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js"
109 + },
110 + "license": "BSD-3-Clause",
111 + "publishConfig": {
112 + "ignore": [
113 + "!dist/*",
114 + "bower.json",
115 + "component.json",
116 + ".github/workflows"
117 + ]
118 + }
119 +>>>>>>> bef06db (Init Address.js)
54 } 120 }
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 'use strict'; 1 'use strict';
2 2
3 var test = require('tape'); 3 var test = require('tape');
4 +<<<<<<< HEAD
5 +=======
6 +var inspect = require('object-inspect');
7 +var SaferBuffer = require('safer-buffer').Buffer;
8 +var forEach = require('for-each');
9 +>>>>>>> bef06db (Init Address.js)
4 var utils = require('../lib/utils'); 10 var utils = require('../lib/utils');
5 11
6 test('merge()', function (t) { 12 test('merge()', function (t) {
...@@ -63,3 +69,74 @@ test('assign()', function (t) { ...@@ -63,3 +69,74 @@ test('assign()', function (t) {
63 69
64 t.end(); 70 t.end();
65 }); 71 });
72 +<<<<<<< HEAD
73 +=======
74 +
75 +test('combine()', function (t) {
76 + t.test('both arrays', function (st) {
77 + var a = [1];
78 + var b = [2];
79 + var combined = utils.combine(a, b);
80 +
81 + st.deepEqual(a, [1], 'a is not mutated');
82 + st.deepEqual(b, [2], 'b is not mutated');
83 + st.notEqual(a, combined, 'a !== combined');
84 + st.notEqual(b, combined, 'b !== combined');
85 + st.deepEqual(combined, [1, 2], 'combined is a + b');
86 +
87 + st.end();
88 + });
89 +
90 + t.test('one array, one non-array', function (st) {
91 + var aN = 1;
92 + var a = [aN];
93 + var bN = 2;
94 + var b = [bN];
95 +
96 + var combinedAnB = utils.combine(aN, b);
97 + st.deepEqual(b, [bN], 'b is not mutated');
98 + st.notEqual(aN, combinedAnB, 'aN + b !== aN');
99 + st.notEqual(a, combinedAnB, 'aN + b !== a');
100 + st.notEqual(bN, combinedAnB, 'aN + b !== bN');
101 + st.notEqual(b, combinedAnB, 'aN + b !== b');
102 + st.deepEqual([1, 2], combinedAnB, 'first argument is array-wrapped when not an array');
103 +
104 + var combinedABn = utils.combine(a, bN);
105 + st.deepEqual(a, [aN], 'a is not mutated');
106 + st.notEqual(aN, combinedABn, 'a + bN !== aN');
107 + st.notEqual(a, combinedABn, 'a + bN !== a');
108 + st.notEqual(bN, combinedABn, 'a + bN !== bN');
109 + st.notEqual(b, combinedABn, 'a + bN !== b');
110 + st.deepEqual([1, 2], combinedABn, 'second argument is array-wrapped when not an array');
111 +
112 + st.end();
113 + });
114 +
115 + t.test('neither is an array', function (st) {
116 + var combined = utils.combine(1, 2);
117 + st.notEqual(1, combined, '1 + 2 !== 1');
118 + st.notEqual(2, combined, '1 + 2 !== 2');
119 + st.deepEqual([1, 2], combined, 'both arguments are array-wrapped when not an array');
120 +
121 + st.end();
122 + });
123 +
124 + t.end();
125 +});
126 +
127 +test('isBuffer()', function (t) {
128 + forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], function () {}, /a/g], function (x) {
129 + t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer');
130 + });
131 +
132 + var fakeBuffer = { constructor: Buffer };
133 + t.equal(utils.isBuffer(fakeBuffer), false, 'fake buffer is not a buffer');
134 +
135 + var saferBuffer = SaferBuffer.from('abc');
136 + t.equal(utils.isBuffer(saferBuffer), true, 'SaferBuffer instance is a buffer');
137 +
138 + var buffer = Buffer.from && Buffer.alloc ? Buffer.from('abc') : new Buffer('abc');
139 + t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer');
140 + t.end();
141 +});
142 +>>>>>>> bef06db (Init Address.js)
......
This diff is collapsed. Click to expand it.
1 { 1 {
2 "dependencies": { 2 "dependencies": {
3 <<<<<<< HEAD 3 <<<<<<< HEAD
4 +<<<<<<< HEAD
4 "request": "^2.88.2" 5 "request": "^2.88.2"
5 ======= 6 =======
6 "express": "^4.18.2", 7 "express": "^4.18.2",
...@@ -9,5 +10,8 @@ ...@@ -9,5 +10,8 @@
9 "request": "^2.88.2", 10 "request": "^2.88.2",
10 "xml-js": "^1.6.11" 11 "xml-js": "^1.6.11"
11 >>>>>>> main 12 >>>>>>> main
13 +=======
14 + "express": "^4.18.2"
15 +>>>>>>> bef06db (Init Address.js)
12 } 16 }
13 } 17 }
......