박지환

Update send data nodejs to ejs

Showing 262 changed files with 4725 additions and 0 deletions
1 +../ejs/bin/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../jake/bin/cli.js
...\ No newline at end of file ...\ No newline at end of file
...@@ -31,6 +31,20 @@ ...@@ -31,6 +31,20 @@
31 "url": "https://github.com/sponsors/epoberezkin" 31 "url": "https://github.com/sponsors/epoberezkin"
32 } 32 }
33 }, 33 },
34 + "node_modules/ansi-styles": {
35 + "version": "4.3.0",
36 + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
37 + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
38 + "dependencies": {
39 + "color-convert": "^2.0.1"
40 + },
41 + "engines": {
42 + "node": ">=8"
43 + },
44 + "funding": {
45 + "url": "https://github.com/chalk/ansi-styles?sponsor=1"
46 + }
47 + },
34 "node_modules/array-flatten": { 48 "node_modules/array-flatten": {
35 "version": "1.1.1", 49 "version": "1.1.1",
36 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 50 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
...@@ -52,6 +66,11 @@ ...@@ -52,6 +66,11 @@
52 "node": ">=0.8" 66 "node": ">=0.8"
53 } 67 }
54 }, 68 },
69 + "node_modules/async": {
70 + "version": "3.2.3",
71 + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
72 + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
73 + },
55 "node_modules/asynckit": { 74 "node_modules/asynckit": {
56 "version": "0.4.0", 75 "version": "0.4.0",
57 "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 76 "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
...@@ -70,6 +89,11 @@ ...@@ -70,6 +89,11 @@
70 "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", 89 "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
71 "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" 90 "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
72 }, 91 },
92 + "node_modules/balanced-match": {
93 + "version": "1.0.2",
94 + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
95 + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
96 + },
73 "node_modules/bcrypt-pbkdf": { 97 "node_modules/bcrypt-pbkdf": {
74 "version": "1.0.2", 98 "version": "1.0.2",
75 "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 99 "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
...@@ -101,6 +125,15 @@ ...@@ -101,6 +125,15 @@
101 "npm": "1.2.8000 || >= 1.4.16" 125 "npm": "1.2.8000 || >= 1.4.16"
102 } 126 }
103 }, 127 },
128 + "node_modules/brace-expansion": {
129 + "version": "1.1.11",
130 + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
131 + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
132 + "dependencies": {
133 + "balanced-match": "^1.0.0",
134 + "concat-map": "0.0.1"
135 + }
136 + },
104 "node_modules/bytes": { 137 "node_modules/bytes": {
105 "version": "3.1.2", 138 "version": "3.1.2",
106 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 139 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
...@@ -126,6 +159,37 @@ ...@@ -126,6 +159,37 @@
126 "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 159 "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
127 "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 160 "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
128 }, 161 },
162 + "node_modules/chalk": {
163 + "version": "4.1.2",
164 + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
165 + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
166 + "dependencies": {
167 + "ansi-styles": "^4.1.0",
168 + "supports-color": "^7.1.0"
169 + },
170 + "engines": {
171 + "node": ">=10"
172 + },
173 + "funding": {
174 + "url": "https://github.com/chalk/chalk?sponsor=1"
175 + }
176 + },
177 + "node_modules/color-convert": {
178 + "version": "2.0.1",
179 + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
180 + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
181 + "dependencies": {
182 + "color-name": "~1.1.4"
183 + },
184 + "engines": {
185 + "node": ">=7.0.0"
186 + }
187 + },
188 + "node_modules/color-name": {
189 + "version": "1.1.4",
190 + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
191 + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
192 + },
129 "node_modules/combined-stream": { 193 "node_modules/combined-stream": {
130 "version": "1.0.8", 194 "version": "1.0.8",
131 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 195 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
...@@ -137,6 +201,11 @@ ...@@ -137,6 +201,11 @@
137 "node": ">= 0.8" 201 "node": ">= 0.8"
138 } 202 }
139 }, 203 },
204 + "node_modules/concat-map": {
205 + "version": "0.0.1",
206 + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
207 + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
208 + },
140 "node_modules/content-disposition": { 209 "node_modules/content-disposition": {
141 "version": "0.5.4", 210 "version": "0.5.4",
142 "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 211 "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
...@@ -232,6 +301,20 @@ ...@@ -232,6 +301,20 @@
232 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 301 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
233 "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 302 "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
234 }, 303 },
304 + "node_modules/ejs": {
305 + "version": "3.1.7",
306 + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz",
307 + "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==",
308 + "dependencies": {
309 + "jake": "^10.8.5"
310 + },
311 + "bin": {
312 + "ejs": "bin/cli.js"
313 + },
314 + "engines": {
315 + "node": ">=0.10.0"
316 + }
317 + },
235 "node_modules/encodeurl": { 318 "node_modules/encodeurl": {
236 "version": "1.0.2", 319 "version": "1.0.2",
237 "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 320 "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
...@@ -317,6 +400,33 @@ ...@@ -317,6 +400,33 @@
317 "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 400 "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
318 "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" 401 "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
319 }, 402 },
403 + "node_modules/filelist": {
404 + "version": "1.0.3",
405 + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz",
406 + "integrity": "sha512-LwjCsruLWQULGYKy7TX0OPtrL9kLpojOFKc5VCTxdFTV7w5zbsgqVKfnkKG7Qgjtq50gKfO56hJv88OfcGb70Q==",
407 + "dependencies": {
408 + "minimatch": "^5.0.1"
409 + }
410 + },
411 + "node_modules/filelist/node_modules/brace-expansion": {
412 + "version": "2.0.1",
413 + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
414 + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
415 + "dependencies": {
416 + "balanced-match": "^1.0.0"
417 + }
418 + },
419 + "node_modules/filelist/node_modules/minimatch": {
420 + "version": "5.0.1",
421 + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
422 + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
423 + "dependencies": {
424 + "brace-expansion": "^2.0.1"
425 + },
426 + "engines": {
427 + "node": ">=10"
428 + }
429 + },
320 "node_modules/finalhandler": { 430 "node_modules/finalhandler": {
321 "version": "1.2.0", 431 "version": "1.2.0",
322 "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 432 "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
...@@ -434,6 +544,14 @@ ...@@ -434,6 +544,14 @@
434 "node": ">= 0.4.0" 544 "node": ">= 0.4.0"
435 } 545 }
436 }, 546 },
547 + "node_modules/has-flag": {
548 + "version": "4.0.0",
549 + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
550 + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
551 + "engines": {
552 + "node": ">=8"
553 + }
554 + },
437 "node_modules/has-symbols": { 555 "node_modules/has-symbols": {
438 "version": "1.0.3", 556 "version": "1.0.3",
439 "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 557 "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
...@@ -508,6 +626,23 @@ ...@@ -508,6 +626,23 @@
508 "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 626 "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
509 "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 627 "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
510 }, 628 },
629 + "node_modules/jake": {
630 + "version": "10.8.5",
631 + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz",
632 + "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==",
633 + "dependencies": {
634 + "async": "^3.2.3",
635 + "chalk": "^4.0.2",
636 + "filelist": "^1.0.1",
637 + "minimatch": "^3.0.4"
638 + },
639 + "bin": {
640 + "jake": "bin/cli.js"
641 + },
642 + "engines": {
643 + "node": ">=10"
644 + }
645 + },
511 "node_modules/jsbn": { 646 "node_modules/jsbn": {
512 "version": "0.1.1", 647 "version": "0.1.1",
513 "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 648 "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
...@@ -593,6 +728,17 @@ ...@@ -593,6 +728,17 @@
593 "node": ">= 0.6" 728 "node": ">= 0.6"
594 } 729 }
595 }, 730 },
731 + "node_modules/minimatch": {
732 + "version": "3.1.2",
733 + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
734 + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
735 + "dependencies": {
736 + "brace-expansion": "^1.1.7"
737 + },
738 + "engines": {
739 + "node": "*"
740 + }
741 + },
596 "node_modules/ms": { 742 "node_modules/ms": {
597 "version": "2.0.0", 743 "version": "2.0.0",
598 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 744 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
...@@ -872,6 +1018,17 @@ ...@@ -872,6 +1018,17 @@
872 "node": ">= 0.8" 1018 "node": ">= 0.8"
873 } 1019 }
874 }, 1020 },
1021 + "node_modules/supports-color": {
1022 + "version": "7.2.0",
1023 + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
1024 + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
1025 + "dependencies": {
1026 + "has-flag": "^4.0.0"
1027 + },
1028 + "engines": {
1029 + "node": ">=8"
1030 + }
1031 + },
875 "node_modules/toidentifier": { 1032 "node_modules/toidentifier": {
876 "version": "1.0.1", 1033 "version": "1.0.1",
877 "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 1034 "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
......
1 +declare type CSSColor =
2 + | 'aliceblue'
3 + | 'antiquewhite'
4 + | 'aqua'
5 + | 'aquamarine'
6 + | 'azure'
7 + | 'beige'
8 + | 'bisque'
9 + | 'black'
10 + | 'blanchedalmond'
11 + | 'blue'
12 + | 'blueviolet'
13 + | 'brown'
14 + | 'burlywood'
15 + | 'cadetblue'
16 + | 'chartreuse'
17 + | 'chocolate'
18 + | 'coral'
19 + | 'cornflowerblue'
20 + | 'cornsilk'
21 + | 'crimson'
22 + | 'cyan'
23 + | 'darkblue'
24 + | 'darkcyan'
25 + | 'darkgoldenrod'
26 + | 'darkgray'
27 + | 'darkgreen'
28 + | 'darkgrey'
29 + | 'darkkhaki'
30 + | 'darkmagenta'
31 + | 'darkolivegreen'
32 + | 'darkorange'
33 + | 'darkorchid'
34 + | 'darkred'
35 + | 'darksalmon'
36 + | 'darkseagreen'
37 + | 'darkslateblue'
38 + | 'darkslategray'
39 + | 'darkslategrey'
40 + | 'darkturquoise'
41 + | 'darkviolet'
42 + | 'deeppink'
43 + | 'deepskyblue'
44 + | 'dimgray'
45 + | 'dimgrey'
46 + | 'dodgerblue'
47 + | 'firebrick'
48 + | 'floralwhite'
49 + | 'forestgreen'
50 + | 'fuchsia'
51 + | 'gainsboro'
52 + | 'ghostwhite'
53 + | 'gold'
54 + | 'goldenrod'
55 + | 'gray'
56 + | 'green'
57 + | 'greenyellow'
58 + | 'grey'
59 + | 'honeydew'
60 + | 'hotpink'
61 + | 'indianred'
62 + | 'indigo'
63 + | 'ivory'
64 + | 'khaki'
65 + | 'lavender'
66 + | 'lavenderblush'
67 + | 'lawngreen'
68 + | 'lemonchiffon'
69 + | 'lightblue'
70 + | 'lightcoral'
71 + | 'lightcyan'
72 + | 'lightgoldenrodyellow'
73 + | 'lightgray'
74 + | 'lightgreen'
75 + | 'lightgrey'
76 + | 'lightpink'
77 + | 'lightsalmon'
78 + | 'lightseagreen'
79 + | 'lightskyblue'
80 + | 'lightslategray'
81 + | 'lightslategrey'
82 + | 'lightsteelblue'
83 + | 'lightyellow'
84 + | 'lime'
85 + | 'limegreen'
86 + | 'linen'
87 + | 'magenta'
88 + | 'maroon'
89 + | 'mediumaquamarine'
90 + | 'mediumblue'
91 + | 'mediumorchid'
92 + | 'mediumpurple'
93 + | 'mediumseagreen'
94 + | 'mediumslateblue'
95 + | 'mediumspringgreen'
96 + | 'mediumturquoise'
97 + | 'mediumvioletred'
98 + | 'midnightblue'
99 + | 'mintcream'
100 + | 'mistyrose'
101 + | 'moccasin'
102 + | 'navajowhite'
103 + | 'navy'
104 + | 'oldlace'
105 + | 'olive'
106 + | 'olivedrab'
107 + | 'orange'
108 + | 'orangered'
109 + | 'orchid'
110 + | 'palegoldenrod'
111 + | 'palegreen'
112 + | 'paleturquoise'
113 + | 'palevioletred'
114 + | 'papayawhip'
115 + | 'peachpuff'
116 + | 'peru'
117 + | 'pink'
118 + | 'plum'
119 + | 'powderblue'
120 + | 'purple'
121 + | 'rebeccapurple'
122 + | 'red'
123 + | 'rosybrown'
124 + | 'royalblue'
125 + | 'saddlebrown'
126 + | 'salmon'
127 + | 'sandybrown'
128 + | 'seagreen'
129 + | 'seashell'
130 + | 'sienna'
131 + | 'silver'
132 + | 'skyblue'
133 + | 'slateblue'
134 + | 'slategray'
135 + | 'slategrey'
136 + | 'snow'
137 + | 'springgreen'
138 + | 'steelblue'
139 + | 'tan'
140 + | 'teal'
141 + | 'thistle'
142 + | 'tomato'
143 + | 'turquoise'
144 + | 'violet'
145 + | 'wheat'
146 + | 'white'
147 + | 'whitesmoke'
148 + | 'yellow'
149 + | 'yellowgreen';
150 +
151 +declare namespace ansiStyles {
152 + interface ColorConvert {
153 + /**
154 + The RGB color space.
155 +
156 + @param red - (`0`-`255`)
157 + @param green - (`0`-`255`)
158 + @param blue - (`0`-`255`)
159 + */
160 + rgb(red: number, green: number, blue: number): string;
161 +
162 + /**
163 + The RGB HEX color space.
164 +
165 + @param hex - A hexadecimal string containing RGB data.
166 + */
167 + hex(hex: string): string;
168 +
169 + /**
170 + @param keyword - A CSS color name.
171 + */
172 + keyword(keyword: CSSColor): string;
173 +
174 + /**
175 + The HSL color space.
176 +
177 + @param hue - (`0`-`360`)
178 + @param saturation - (`0`-`100`)
179 + @param lightness - (`0`-`100`)
180 + */
181 + hsl(hue: number, saturation: number, lightness: number): string;
182 +
183 + /**
184 + The HSV color space.
185 +
186 + @param hue - (`0`-`360`)
187 + @param saturation - (`0`-`100`)
188 + @param value - (`0`-`100`)
189 + */
190 + hsv(hue: number, saturation: number, value: number): string;
191 +
192 + /**
193 + The HSV color space.
194 +
195 + @param hue - (`0`-`360`)
196 + @param whiteness - (`0`-`100`)
197 + @param blackness - (`0`-`100`)
198 + */
199 + hwb(hue: number, whiteness: number, blackness: number): string;
200 +
201 + /**
202 + Use a [4-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4-bit) to set text color.
203 + */
204 + ansi(ansi: number): string;
205 +
206 + /**
207 + Use an [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
208 + */
209 + ansi256(ansi: number): string;
210 + }
211 +
212 + interface CSPair {
213 + /**
214 + The ANSI terminal control sequence for starting this style.
215 + */
216 + readonly open: string;
217 +
218 + /**
219 + The ANSI terminal control sequence for ending this style.
220 + */
221 + readonly close: string;
222 + }
223 +
224 + interface ColorBase {
225 + readonly ansi: ColorConvert;
226 + readonly ansi256: ColorConvert;
227 + readonly ansi16m: ColorConvert;
228 +
229 + /**
230 + The ANSI terminal control sequence for ending this color.
231 + */
232 + readonly close: string;
233 + }
234 +
235 + interface Modifier {
236 + /**
237 + Resets the current color chain.
238 + */
239 + readonly reset: CSPair;
240 +
241 + /**
242 + Make text bold.
243 + */
244 + readonly bold: CSPair;
245 +
246 + /**
247 + Emitting only a small amount of light.
248 + */
249 + readonly dim: CSPair;
250 +
251 + /**
252 + Make text italic. (Not widely supported)
253 + */
254 + readonly italic: CSPair;
255 +
256 + /**
257 + Make text underline. (Not widely supported)
258 + */
259 + readonly underline: CSPair;
260 +
261 + /**
262 + Inverse background and foreground colors.
263 + */
264 + readonly inverse: CSPair;
265 +
266 + /**
267 + Prints the text, but makes it invisible.
268 + */
269 + readonly hidden: CSPair;
270 +
271 + /**
272 + Puts a horizontal line through the center of the text. (Not widely supported)
273 + */
274 + readonly strikethrough: CSPair;
275 + }
276 +
277 + interface ForegroundColor {
278 + readonly black: CSPair;
279 + readonly red: CSPair;
280 + readonly green: CSPair;
281 + readonly yellow: CSPair;
282 + readonly blue: CSPair;
283 + readonly cyan: CSPair;
284 + readonly magenta: CSPair;
285 + readonly white: CSPair;
286 +
287 + /**
288 + Alias for `blackBright`.
289 + */
290 + readonly gray: CSPair;
291 +
292 + /**
293 + Alias for `blackBright`.
294 + */
295 + readonly grey: CSPair;
296 +
297 + readonly blackBright: CSPair;
298 + readonly redBright: CSPair;
299 + readonly greenBright: CSPair;
300 + readonly yellowBright: CSPair;
301 + readonly blueBright: CSPair;
302 + readonly cyanBright: CSPair;
303 + readonly magentaBright: CSPair;
304 + readonly whiteBright: CSPair;
305 + }
306 +
307 + interface BackgroundColor {
308 + readonly bgBlack: CSPair;
309 + readonly bgRed: CSPair;
310 + readonly bgGreen: CSPair;
311 + readonly bgYellow: CSPair;
312 + readonly bgBlue: CSPair;
313 + readonly bgCyan: CSPair;
314 + readonly bgMagenta: CSPair;
315 + readonly bgWhite: CSPair;
316 +
317 + /**
318 + Alias for `bgBlackBright`.
319 + */
320 + readonly bgGray: CSPair;
321 +
322 + /**
323 + Alias for `bgBlackBright`.
324 + */
325 + readonly bgGrey: CSPair;
326 +
327 + readonly bgBlackBright: CSPair;
328 + readonly bgRedBright: CSPair;
329 + readonly bgGreenBright: CSPair;
330 + readonly bgYellowBright: CSPair;
331 + readonly bgBlueBright: CSPair;
332 + readonly bgCyanBright: CSPair;
333 + readonly bgMagentaBright: CSPair;
334 + readonly bgWhiteBright: CSPair;
335 + }
336 +}
337 +
338 +declare const ansiStyles: {
339 + readonly modifier: ansiStyles.Modifier;
340 + readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase;
341 + readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase;
342 + readonly codes: ReadonlyMap<number, number>;
343 +} & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier;
344 +
345 +export = ansiStyles;
1 +'use strict';
2 +
3 +const wrapAnsi16 = (fn, offset) => (...args) => {
4 + const code = fn(...args);
5 + return `\u001B[${code + offset}m`;
6 +};
7 +
8 +const wrapAnsi256 = (fn, offset) => (...args) => {
9 + const code = fn(...args);
10 + return `\u001B[${38 + offset};5;${code}m`;
11 +};
12 +
13 +const wrapAnsi16m = (fn, offset) => (...args) => {
14 + const rgb = fn(...args);
15 + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
16 +};
17 +
18 +const ansi2ansi = n => n;
19 +const rgb2rgb = (r, g, b) => [r, g, b];
20 +
21 +const setLazyProperty = (object, property, get) => {
22 + Object.defineProperty(object, property, {
23 + get: () => {
24 + const value = get();
25 +
26 + Object.defineProperty(object, property, {
27 + value,
28 + enumerable: true,
29 + configurable: true
30 + });
31 +
32 + return value;
33 + },
34 + enumerable: true,
35 + configurable: true
36 + });
37 +};
38 +
39 +/** @type {typeof import('color-convert')} */
40 +let colorConvert;
41 +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
42 + if (colorConvert === undefined) {
43 + colorConvert = require('color-convert');
44 + }
45 +
46 + const offset = isBackground ? 10 : 0;
47 + const styles = {};
48 +
49 + for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
50 + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
51 + if (sourceSpace === targetSpace) {
52 + styles[name] = wrap(identity, offset);
53 + } else if (typeof suite === 'object') {
54 + styles[name] = wrap(suite[targetSpace], offset);
55 + }
56 + }
57 +
58 + return styles;
59 +};
60 +
61 +function assembleStyles() {
62 + const codes = new Map();
63 + const styles = {
64 + modifier: {
65 + reset: [0, 0],
66 + // 21 isn't widely supported and 22 does the same thing
67 + bold: [1, 22],
68 + dim: [2, 22],
69 + italic: [3, 23],
70 + underline: [4, 24],
71 + inverse: [7, 27],
72 + hidden: [8, 28],
73 + strikethrough: [9, 29]
74 + },
75 + color: {
76 + black: [30, 39],
77 + red: [31, 39],
78 + green: [32, 39],
79 + yellow: [33, 39],
80 + blue: [34, 39],
81 + magenta: [35, 39],
82 + cyan: [36, 39],
83 + white: [37, 39],
84 +
85 + // Bright color
86 + blackBright: [90, 39],
87 + redBright: [91, 39],
88 + greenBright: [92, 39],
89 + yellowBright: [93, 39],
90 + blueBright: [94, 39],
91 + magentaBright: [95, 39],
92 + cyanBright: [96, 39],
93 + whiteBright: [97, 39]
94 + },
95 + bgColor: {
96 + bgBlack: [40, 49],
97 + bgRed: [41, 49],
98 + bgGreen: [42, 49],
99 + bgYellow: [43, 49],
100 + bgBlue: [44, 49],
101 + bgMagenta: [45, 49],
102 + bgCyan: [46, 49],
103 + bgWhite: [47, 49],
104 +
105 + // Bright color
106 + bgBlackBright: [100, 49],
107 + bgRedBright: [101, 49],
108 + bgGreenBright: [102, 49],
109 + bgYellowBright: [103, 49],
110 + bgBlueBright: [104, 49],
111 + bgMagentaBright: [105, 49],
112 + bgCyanBright: [106, 49],
113 + bgWhiteBright: [107, 49]
114 + }
115 + };
116 +
117 + // Alias bright black as gray (and grey)
118 + styles.color.gray = styles.color.blackBright;
119 + styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
120 + styles.color.grey = styles.color.blackBright;
121 + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
122 +
123 + for (const [groupName, group] of Object.entries(styles)) {
124 + for (const [styleName, style] of Object.entries(group)) {
125 + styles[styleName] = {
126 + open: `\u001B[${style[0]}m`,
127 + close: `\u001B[${style[1]}m`
128 + };
129 +
130 + group[styleName] = styles[styleName];
131 +
132 + codes.set(style[0], style[1]);
133 + }
134 +
135 + Object.defineProperty(styles, groupName, {
136 + value: group,
137 + enumerable: false
138 + });
139 + }
140 +
141 + Object.defineProperty(styles, 'codes', {
142 + value: codes,
143 + enumerable: false
144 + });
145 +
146 + styles.color.close = '\u001B[39m';
147 + styles.bgColor.close = '\u001B[49m';
148 +
149 + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
150 + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
151 + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
152 + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
153 + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
154 + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
155 +
156 + return styles;
157 +}
158 +
159 +// Make the export immutable
160 +Object.defineProperty(module, 'exports', {
161 + enumerable: true,
162 + get: assembleStyles
163 +});
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +{
2 + "name": "ansi-styles",
3 + "version": "4.3.0",
4 + "description": "ANSI escape codes for styling strings in the terminal",
5 + "license": "MIT",
6 + "repository": "chalk/ansi-styles",
7 + "funding": "https://github.com/chalk/ansi-styles?sponsor=1",
8 + "author": {
9 + "name": "Sindre Sorhus",
10 + "email": "sindresorhus@gmail.com",
11 + "url": "sindresorhus.com"
12 + },
13 + "engines": {
14 + "node": ">=8"
15 + },
16 + "scripts": {
17 + "test": "xo && ava && tsd",
18 + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor"
19 + },
20 + "files": [
21 + "index.js",
22 + "index.d.ts"
23 + ],
24 + "keywords": [
25 + "ansi",
26 + "styles",
27 + "color",
28 + "colour",
29 + "colors",
30 + "terminal",
31 + "console",
32 + "cli",
33 + "string",
34 + "tty",
35 + "escape",
36 + "formatting",
37 + "rgb",
38 + "256",
39 + "shell",
40 + "xterm",
41 + "log",
42 + "logging",
43 + "command-line",
44 + "text"
45 + ],
46 + "dependencies": {
47 + "color-convert": "^2.0.1"
48 + },
49 + "devDependencies": {
50 + "@types/color-convert": "^1.9.0",
51 + "ava": "^2.3.0",
52 + "svg-term-cli": "^2.1.1",
53 + "tsd": "^0.11.0",
54 + "xo": "^0.25.3"
55 + }
56 +}
1 +# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles)
2 +
3 +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
4 +
5 +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
6 +
7 +<img src="screenshot.svg" width="900">
8 +
9 +## Install
10 +
11 +```
12 +$ npm install ansi-styles
13 +```
14 +
15 +## Usage
16 +
17 +```js
18 +const style = require('ansi-styles');
19 +
20 +console.log(`${style.green.open}Hello world!${style.green.close}`);
21 +
22 +
23 +// Color conversion between 16/256/truecolor
24 +// NOTE: If conversion goes to 16 colors or 256 colors, the original color
25 +// may be degraded to fit that color palette. This means terminals
26 +// that do not support 16 million colors will best-match the
27 +// original color.
28 +console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
29 +console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
30 +console.log(style.color.ansi16m.hex('#abcdef') + 'Hello world!' + style.color.close);
31 +```
32 +
33 +## API
34 +
35 +Each style has an `open` and `close` property.
36 +
37 +## Styles
38 +
39 +### Modifiers
40 +
41 +- `reset`
42 +- `bold`
43 +- `dim`
44 +- `italic` *(Not widely supported)*
45 +- `underline`
46 +- `inverse`
47 +- `hidden`
48 +- `strikethrough` *(Not widely supported)*
49 +
50 +### Colors
51 +
52 +- `black`
53 +- `red`
54 +- `green`
55 +- `yellow`
56 +- `blue`
57 +- `magenta`
58 +- `cyan`
59 +- `white`
60 +- `blackBright` (alias: `gray`, `grey`)
61 +- `redBright`
62 +- `greenBright`
63 +- `yellowBright`
64 +- `blueBright`
65 +- `magentaBright`
66 +- `cyanBright`
67 +- `whiteBright`
68 +
69 +### Background colors
70 +
71 +- `bgBlack`
72 +- `bgRed`
73 +- `bgGreen`
74 +- `bgYellow`
75 +- `bgBlue`
76 +- `bgMagenta`
77 +- `bgCyan`
78 +- `bgWhite`
79 +- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
80 +- `bgRedBright`
81 +- `bgGreenBright`
82 +- `bgYellowBright`
83 +- `bgBlueBright`
84 +- `bgMagentaBright`
85 +- `bgCyanBright`
86 +- `bgWhiteBright`
87 +
88 +## Advanced usage
89 +
90 +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
91 +
92 +- `style.modifier`
93 +- `style.color`
94 +- `style.bgColor`
95 +
96 +###### Example
97 +
98 +```js
99 +console.log(style.color.green.open);
100 +```
101 +
102 +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
103 +
104 +###### Example
105 +
106 +```js
107 +console.log(style.codes.get(36));
108 +//=> 39
109 +```
110 +
111 +## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
112 +
113 +`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
114 +
115 +The following color spaces from `color-convert` are supported:
116 +
117 +- `rgb`
118 +- `hex`
119 +- `keyword`
120 +- `hsl`
121 +- `hsv`
122 +- `hwb`
123 +- `ansi`
124 +- `ansi256`
125 +
126 +To use these, call the associated conversion function with the intended output, for example:
127 +
128 +```js
129 +style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
130 +style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
131 +
132 +style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
133 +style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
134 +
135 +style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
136 +style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
137 +```
138 +
139 +## Related
140 +
141 +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
142 +
143 +## Maintainers
144 +
145 +- [Sindre Sorhus](https://github.com/sindresorhus)
146 +- [Josh Junon](https://github.com/qix-)
147 +
148 +## For enterprise
149 +
150 +Available as part of the Tidelift Subscription.
151 +
152 +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
This diff is collapsed. Click to expand it.
1 +Copyright (c) 2010-2018 Caolan McMahon
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
1 +![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg)
2 +
3 +[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)
4 +[![Build Status via Azure Pipelines](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master)
5 +[![NPM version](https://img.shields.io/npm/v/async.svg)](https://www.npmjs.com/package/async)
6 +[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master)
7 +[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8 +[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/async/badge?style=rounded)](https://www.jsdelivr.com/package/npm/async)
9 +
10 +<!--
11 +|Linux|Windows|MacOS|
12 +|-|-|-|
13 +|[![Linux Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=Linux&configuration=Linux%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [![Windows Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=Windows&configuration=Windows%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [![MacOS Build Status](https://dev.azure.com/caolanmcmahon/async/_apis/build/status/caolan.async?branchName=master&jobName=OSX&configuration=OSX%20node_10_x)](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master)| -->
14 +
15 +Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/v3/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm i async`, it can also be used directly in the browser. A ESM/MJS version is included in the main `async` package that should automatically be used with compatible bundlers such as Webpack and Rollup.
16 +
17 +A pure ESM version of Async is available as [`async-es`](https://www.npmjs.com/package/async-es).
18 +
19 +For Documentation, visit <https://caolan.github.io/async/>
20 +
21 +*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)*
22 +
23 +
24 +```javascript
25 +// for use with Node-style callbacks...
26 +var async = require("async");
27 +
28 +var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
29 +var configs = {};
30 +
31 +async.forEachOf(obj, (value, key, callback) => {
32 + fs.readFile(__dirname + value, "utf8", (err, data) => {
33 + if (err) return callback(err);
34 + try {
35 + configs[key] = JSON.parse(data);
36 + } catch (e) {
37 + return callback(e);
38 + }
39 + callback();
40 + });
41 +}, err => {
42 + if (err) console.error(err.message);
43 + // configs is now a map of JSON data
44 + doSomethingWith(configs);
45 +});
46 +```
47 +
48 +```javascript
49 +var async = require("async");
50 +
51 +// ...or ES2017 async functions
52 +async.mapLimit(urls, 5, async function(url) {
53 + const response = await fetch(url)
54 + return response.body
55 +}, (err, results) => {
56 + if (err) throw err
57 + // results is now an array of the response bodies
58 + console.log(results)
59 +})
60 +```
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOf = require('./eachOf.js');
12 +
13 +var _eachOf2 = _interopRequireDefault(_eachOf);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Returns `true` if every element in `coll` satisfies an async test. If any
23 + * iteratee call returns `false`, the main `callback` is immediately called.
24 + *
25 + * @name every
26 + * @static
27 + * @memberOf module:Collections
28 + * @method
29 + * @alias all
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
33 + * in the collection in parallel.
34 + * The iteratee must complete with a boolean result value.
35 + * Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called after all the
37 + * `iteratee` functions have finished. Result will be either `true` or `false`
38 + * depending on the values of the async tests. Invoked with (err, result).
39 + * @returns {Promise} a promise, if no callback provided
40 + * @example
41 + *
42 + * // dir1 is a directory that contains file1.txt, file2.txt
43 + * // dir2 is a directory that contains file3.txt, file4.txt
44 + * // dir3 is a directory that contains file5.txt
45 + * // dir4 does not exist
46 + *
47 + * const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
48 + * const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
49 + *
50 + * // asynchronous function that checks if a file exists
51 + * function fileExists(file, callback) {
52 + * fs.access(file, fs.constants.F_OK, (err) => {
53 + * callback(null, !err);
54 + * });
55 + * }
56 + *
57 + * // Using callbacks
58 + * async.every(fileList, fileExists, function(err, result) {
59 + * console.log(result);
60 + * // true
61 + * // result is true since every file exists
62 + * });
63 + *
64 + * async.every(withMissingFileList, fileExists, function(err, result) {
65 + * console.log(result);
66 + * // false
67 + * // result is false since NOT every file exists
68 + * });
69 + *
70 + * // Using Promises
71 + * async.every(fileList, fileExists)
72 + * .then( result => {
73 + * console.log(result);
74 + * // true
75 + * // result is true since every file exists
76 + * }).catch( err => {
77 + * console.log(err);
78 + * });
79 + *
80 + * async.every(withMissingFileList, fileExists)
81 + * .then( result => {
82 + * console.log(result);
83 + * // false
84 + * // result is false since NOT every file exists
85 + * }).catch( err => {
86 + * console.log(err);
87 + * });
88 + *
89 + * // Using async/await
90 + * async () => {
91 + * try {
92 + * let result = await async.every(fileList, fileExists);
93 + * console.log(result);
94 + * // true
95 + * // result is true since every file exists
96 + * }
97 + * catch (err) {
98 + * console.log(err);
99 + * }
100 + * }
101 + *
102 + * async () => {
103 + * try {
104 + * let result = await async.every(withMissingFileList, fileExists);
105 + * console.log(result);
106 + * // false
107 + * // result is false since NOT every file exists
108 + * }
109 + * catch (err) {
110 + * console.log(err);
111 + * }
112 + * }
113 + *
114 + */
115 +function every(coll, iteratee, callback) {
116 + return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
117 +}
118 +exports.default = (0, _awaitify2.default)(every, 3);
119 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
23 + *
24 + * @name everyLimit
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.every]{@link module:Collections.every}
29 + * @alias allLimit
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {number} limit - The maximum number of async operations at a time.
33 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34 + * in the collection in parallel.
35 + * The iteratee must complete with a boolean result value.
36 + * Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called after all the
38 + * `iteratee` functions have finished. Result will be either `true` or `false`
39 + * depending on the values of the async tests. Invoked with (err, result).
40 + * @returns {Promise} a promise, if no callback provided
41 + */
42 +function everyLimit(coll, limit, iteratee, callback) {
43 + return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
44 +}
45 +exports.default = (0, _awaitify2.default)(everyLimit, 4);
46 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfSeries = require('./eachOfSeries.js');
12 +
13 +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
23 + *
24 + * @name everySeries
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.every]{@link module:Collections.every}
29 + * @alias allSeries
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
33 + * in the collection in series.
34 + * The iteratee must complete with a boolean result value.
35 + * Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called after all the
37 + * `iteratee` functions have finished. Result will be either `true` or `false`
38 + * depending on the values of the async tests. Invoked with (err, result).
39 + * @returns {Promise} a promise, if no callback provided
40 + */
41 +function everySeries(coll, iteratee, callback) {
42 + return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback);
43 +}
44 +exports.default = (0, _awaitify2.default)(everySeries, 3);
45 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOf = require('./eachOf.js');
12 +
13 +var _eachOf2 = _interopRequireDefault(_eachOf);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Returns `true` if at least one element in the `coll` satisfies an async test.
23 + * If any iteratee call returns `true`, the main `callback` is immediately
24 + * called.
25 + *
26 + * @name some
27 + * @static
28 + * @memberOf module:Collections
29 + * @method
30 + * @alias any
31 + * @category Collection
32 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34 + * in the collections in parallel.
35 + * The iteratee should complete with a boolean `result` value.
36 + * Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called as soon as any
38 + * iteratee returns `true`, or after all the iteratee functions have finished.
39 + * Result will be either `true` or `false` depending on the values of the async
40 + * tests. Invoked with (err, result).
41 + * @returns {Promise} a promise, if no callback provided
42 + * @example
43 + *
44 + * // dir1 is a directory that contains file1.txt, file2.txt
45 + * // dir2 is a directory that contains file3.txt, file4.txt
46 + * // dir3 is a directory that contains file5.txt
47 + * // dir4 does not exist
48 + *
49 + * // asynchronous function that checks if a file exists
50 + * function fileExists(file, callback) {
51 + * fs.access(file, fs.constants.F_OK, (err) => {
52 + * callback(null, !err);
53 + * });
54 + * }
55 + *
56 + * // Using callbacks
57 + * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
58 + * function(err, result) {
59 + * console.log(result);
60 + * // true
61 + * // result is true since some file in the list exists
62 + * }
63 + *);
64 + *
65 + * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
66 + * function(err, result) {
67 + * console.log(result);
68 + * // false
69 + * // result is false since none of the files exists
70 + * }
71 + *);
72 + *
73 + * // Using Promises
74 + * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
75 + * .then( result => {
76 + * console.log(result);
77 + * // true
78 + * // result is true since some file in the list exists
79 + * }).catch( err => {
80 + * console.log(err);
81 + * });
82 + *
83 + * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
84 + * .then( result => {
85 + * console.log(result);
86 + * // false
87 + * // result is false since none of the files exists
88 + * }).catch( err => {
89 + * console.log(err);
90 + * });
91 + *
92 + * // Using async/await
93 + * async () => {
94 + * try {
95 + * let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
96 + * console.log(result);
97 + * // true
98 + * // result is true since some file in the list exists
99 + * }
100 + * catch (err) {
101 + * console.log(err);
102 + * }
103 + * }
104 + *
105 + * async () => {
106 + * try {
107 + * let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
108 + * console.log(result);
109 + * // false
110 + * // result is false since none of the files exists
111 + * }
112 + * catch (err) {
113 + * console.log(err);
114 + * }
115 + * }
116 + *
117 + */
118 +function some(coll, iteratee, callback) {
119 + return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);
120 +}
121 +exports.default = (0, _awaitify2.default)(some, 3);
122 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
23 + *
24 + * @name someLimit
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.some]{@link module:Collections.some}
29 + * @alias anyLimit
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {number} limit - The maximum number of async operations at a time.
33 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34 + * in the collections in parallel.
35 + * The iteratee should complete with a boolean `result` value.
36 + * Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called as soon as any
38 + * iteratee returns `true`, or after all the iteratee functions have finished.
39 + * Result will be either `true` or `false` depending on the values of the async
40 + * tests. Invoked with (err, result).
41 + * @returns {Promise} a promise, if no callback provided
42 + */
43 +function someLimit(coll, limit, iteratee, callback) {
44 + return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
45 +}
46 +exports.default = (0, _awaitify2.default)(someLimit, 4);
47 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfSeries = require('./eachOfSeries.js');
12 +
13 +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
23 + *
24 + * @name someSeries
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.some]{@link module:Collections.some}
29 + * @alias anySeries
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
33 + * in the collections in series.
34 + * The iteratee should complete with a boolean `result` value.
35 + * Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called as soon as any
37 + * iteratee returns `true`, or after all the iteratee functions have finished.
38 + * Result will be either `true` or `false` depending on the values of the async
39 + * tests. Invoked with (err, result).
40 + * @returns {Promise} a promise, if no callback provided
41 + */
42 +function someSeries(coll, iteratee, callback) {
43 + return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback);
44 +}
45 +exports.default = (0, _awaitify2.default)(someSeries, 3);
46 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +exports.default = function (fn, ...args) {
8 + return (...callArgs) => fn(...args, ...callArgs);
9 +};
10 +
11 +module.exports = exports["default"]; /**
12 + * Creates a continuation function with some arguments already applied.
13 + *
14 + * Useful as a shorthand when combined with other control flow functions. Any
15 + * arguments passed to the returned function are added to the arguments
16 + * originally passed to apply.
17 + *
18 + * @name apply
19 + * @static
20 + * @memberOf module:Utils
21 + * @method
22 + * @category Util
23 + * @param {Function} fn - The function you want to eventually apply all
24 + * arguments to. Invokes with (arguments...).
25 + * @param {...*} arguments... - Any number of arguments to automatically apply
26 + * when the continuation is called.
27 + * @returns {Function} the partially-applied function
28 + * @example
29 + *
30 + * // using apply
31 + * async.parallel([
32 + * async.apply(fs.writeFile, 'testfile1', 'test1'),
33 + * async.apply(fs.writeFile, 'testfile2', 'test2')
34 + * ]);
35 + *
36 + *
37 + * // the same process without using apply
38 + * async.parallel([
39 + * function(callback) {
40 + * fs.writeFile('testfile1', 'test1', callback);
41 + * },
42 + * function(callback) {
43 + * fs.writeFile('testfile2', 'test2', callback);
44 + * }
45 + * ]);
46 + *
47 + * // It's possible to pass any number of additional arguments when calling the
48 + * // continuation:
49 + *
50 + * node> var fn = async.apply(sys.puts, 'one');
51 + * node> fn('two', 'three');
52 + * one
53 + * two
54 + * three
55 + */
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _applyEach = require('./internal/applyEach.js');
8 +
9 +var _applyEach2 = _interopRequireDefault(_applyEach);
10 +
11 +var _map = require('./map.js');
12 +
13 +var _map2 = _interopRequireDefault(_map);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * Applies the provided arguments to each function in the array, calling
19 + * `callback` after all functions have completed. If you only provide the first
20 + * argument, `fns`, then it will return a function which lets you pass in the
21 + * arguments as if it were a single function call. If more arguments are
22 + * provided, `callback` is required while `args` is still optional. The results
23 + * for each of the applied async functions are passed to the final callback
24 + * as an array.
25 + *
26 + * @name applyEach
27 + * @static
28 + * @memberOf module:ControlFlow
29 + * @method
30 + * @category Control Flow
31 + * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s
32 + * to all call with the same arguments
33 + * @param {...*} [args] - any number of separate arguments to pass to the
34 + * function.
35 + * @param {Function} [callback] - the final argument should be the callback,
36 + * called when all functions have completed processing.
37 + * @returns {AsyncFunction} - Returns a function that takes no args other than
38 + * an optional callback, that is the result of applying the `args` to each
39 + * of the functions.
40 + * @example
41 + *
42 + * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
43 + *
44 + * appliedFn((err, results) => {
45 + * // results[0] is the results for `enableSearch`
46 + * // results[1] is the results for `updateSchema`
47 + * });
48 + *
49 + * // partial application example:
50 + * async.each(
51 + * buckets,
52 + * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
53 + * callback
54 + * );
55 + */
56 +exports.default = (0, _applyEach2.default)(_map2.default);
57 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _applyEach = require('./internal/applyEach.js');
8 +
9 +var _applyEach2 = _interopRequireDefault(_applyEach);
10 +
11 +var _mapSeries = require('./mapSeries.js');
12 +
13 +var _mapSeries2 = _interopRequireDefault(_mapSeries);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
19 + *
20 + * @name applyEachSeries
21 + * @static
22 + * @memberOf module:ControlFlow
23 + * @method
24 + * @see [async.applyEach]{@link module:ControlFlow.applyEach}
25 + * @category Control Flow
26 + * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all
27 + * call with the same arguments
28 + * @param {...*} [args] - any number of separate arguments to pass to the
29 + * function.
30 + * @param {Function} [callback] - the final argument should be the callback,
31 + * called when all functions have completed processing.
32 + * @returns {AsyncFunction} - A function, that when called, is the result of
33 + * appling the `args` to the list of functions. It takes no args, other than
34 + * a callback.
35 + */
36 +exports.default = (0, _applyEach2.default)(_mapSeries2.default);
37 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = asyncify;
7 +
8 +var _initialParams = require('./internal/initialParams.js');
9 +
10 +var _initialParams2 = _interopRequireDefault(_initialParams);
11 +
12 +var _setImmediate = require('./internal/setImmediate.js');
13 +
14 +var _setImmediate2 = _interopRequireDefault(_setImmediate);
15 +
16 +var _wrapAsync = require('./internal/wrapAsync.js');
17 +
18 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19 +
20 +/**
21 + * Take a sync function and make it async, passing its return value to a
22 + * callback. This is useful for plugging sync functions into a waterfall,
23 + * series, or other async functions. Any arguments passed to the generated
24 + * function will be passed to the wrapped function (except for the final
25 + * callback argument). Errors thrown will be passed to the callback.
26 + *
27 + * If the function passed to `asyncify` returns a Promise, that promises's
28 + * resolved/rejected state will be used to call the callback, rather than simply
29 + * the synchronous return value.
30 + *
31 + * This also means you can asyncify ES2017 `async` functions.
32 + *
33 + * @name asyncify
34 + * @static
35 + * @memberOf module:Utils
36 + * @method
37 + * @alias wrapSync
38 + * @category Util
39 + * @param {Function} func - The synchronous function, or Promise-returning
40 + * function to convert to an {@link AsyncFunction}.
41 + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
42 + * invoked with `(args..., callback)`.
43 + * @example
44 + *
45 + * // passing a regular synchronous function
46 + * async.waterfall([
47 + * async.apply(fs.readFile, filename, "utf8"),
48 + * async.asyncify(JSON.parse),
49 + * function (data, next) {
50 + * // data is the result of parsing the text.
51 + * // If there was a parsing error, it would have been caught.
52 + * }
53 + * ], callback);
54 + *
55 + * // passing a function returning a promise
56 + * async.waterfall([
57 + * async.apply(fs.readFile, filename, "utf8"),
58 + * async.asyncify(function (contents) {
59 + * return db.model.create(contents);
60 + * }),
61 + * function (model, next) {
62 + * // `model` is the instantiated model object.
63 + * // If there was an error, this function would be skipped.
64 + * }
65 + * ], callback);
66 + *
67 + * // es2017 example, though `asyncify` is not needed if your JS environment
68 + * // supports async functions out of the box
69 + * var q = async.queue(async.asyncify(async function(file) {
70 + * var intermediateStep = await processFile(file);
71 + * return await somePromise(intermediateStep)
72 + * }));
73 + *
74 + * q.push(files);
75 + */
76 +function asyncify(func) {
77 + if ((0, _wrapAsync.isAsync)(func)) {
78 + return function (...args /*, callback*/) {
79 + const callback = args.pop();
80 + const promise = func.apply(this, args);
81 + return handlePromise(promise, callback);
82 + };
83 + }
84 +
85 + return (0, _initialParams2.default)(function (args, callback) {
86 + var result;
87 + try {
88 + result = func.apply(this, args);
89 + } catch (e) {
90 + return callback(e);
91 + }
92 + // if result is Promise object
93 + if (result && typeof result.then === 'function') {
94 + return handlePromise(result, callback);
95 + } else {
96 + callback(null, result);
97 + }
98 + });
99 +}
100 +
101 +function handlePromise(promise, callback) {
102 + return promise.then(value => {
103 + invokeCallback(callback, null, value);
104 + }, err => {
105 + invokeCallback(callback, err && err.message ? err : new Error(err));
106 + });
107 +}
108 +
109 +function invokeCallback(callback, error, value) {
110 + try {
111 + callback(error, value);
112 + } catch (err) {
113 + (0, _setImmediate2.default)(e => {
114 + throw e;
115 + }, err);
116 + }
117 +}
118 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = autoInject;
7 +
8 +var _auto = require('./auto.js');
9 +
10 +var _auto2 = _interopRequireDefault(_auto);
11 +
12 +var _wrapAsync = require('./internal/wrapAsync.js');
13 +
14 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15 +
16 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 +
18 +var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
19 +var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
20 +var FN_ARG_SPLIT = /,/;
21 +var FN_ARG = /(=.+)?(\s*)$/;
22 +
23 +function stripComments(string) {
24 + let stripped = '';
25 + let index = 0;
26 + let endBlockComment = string.indexOf('*/');
27 + while (index < string.length) {
28 + if (string[index] === '/' && string[index + 1] === '/') {
29 + // inline comment
30 + let endIndex = string.indexOf('\n', index);
31 + index = endIndex === -1 ? string.length : endIndex;
32 + } else if (endBlockComment !== -1 && string[index] === '/' && string[index + 1] === '*') {
33 + // block comment
34 + let endIndex = string.indexOf('*/', index);
35 + if (endIndex !== -1) {
36 + index = endIndex + 2;
37 + endBlockComment = string.indexOf('*/', index);
38 + } else {
39 + stripped += string[index];
40 + index++;
41 + }
42 + } else {
43 + stripped += string[index];
44 + index++;
45 + }
46 + }
47 + return stripped;
48 +}
49 +
50 +function parseParams(func) {
51 + const src = stripComments(func.toString());
52 + let match = src.match(FN_ARGS);
53 + if (!match) {
54 + match = src.match(ARROW_FN_ARGS);
55 + }
56 + if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src);
57 + let [, args] = match;
58 + return args.replace(/\s/g, '').split(FN_ARG_SPLIT).map(arg => arg.replace(FN_ARG, '').trim());
59 +}
60 +
61 +/**
62 + * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent
63 + * tasks are specified as parameters to the function, after the usual callback
64 + * parameter, with the parameter names matching the names of the tasks it
65 + * depends on. This can provide even more readable task graphs which can be
66 + * easier to maintain.
67 + *
68 + * If a final callback is specified, the task results are similarly injected,
69 + * specified as named parameters after the initial error parameter.
70 + *
71 + * The autoInject function is purely syntactic sugar and its semantics are
72 + * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
73 + *
74 + * @name autoInject
75 + * @static
76 + * @memberOf module:ControlFlow
77 + * @method
78 + * @see [async.auto]{@link module:ControlFlow.auto}
79 + * @category Control Flow
80 + * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
81 + * the form 'func([dependencies...], callback). The object's key of a property
82 + * serves as the name of the task defined by that property, i.e. can be used
83 + * when specifying requirements for other tasks.
84 + * * The `callback` parameter is a `callback(err, result)` which must be called
85 + * when finished, passing an `error` (which can be `null`) and the result of
86 + * the function's execution. The remaining parameters name other tasks on
87 + * which the task is dependent, and the results from those tasks are the
88 + * arguments of those parameters.
89 + * @param {Function} [callback] - An optional callback which is called when all
90 + * the tasks have been completed. It receives the `err` argument if any `tasks`
91 + * pass an error to their callback, and a `results` object with any completed
92 + * task results, similar to `auto`.
93 + * @returns {Promise} a promise, if no callback is passed
94 + * @example
95 + *
96 + * // The example from `auto` can be rewritten as follows:
97 + * async.autoInject({
98 + * get_data: function(callback) {
99 + * // async code to get some data
100 + * callback(null, 'data', 'converted to array');
101 + * },
102 + * make_folder: function(callback) {
103 + * // async code to create a directory to store a file in
104 + * // this is run at the same time as getting the data
105 + * callback(null, 'folder');
106 + * },
107 + * write_file: function(get_data, make_folder, callback) {
108 + * // once there is some data and the directory exists,
109 + * // write the data to a file in the directory
110 + * callback(null, 'filename');
111 + * },
112 + * email_link: function(write_file, callback) {
113 + * // once the file is written let's email a link to it...
114 + * // write_file contains the filename returned by write_file.
115 + * callback(null, {'file':write_file, 'email':'user@example.com'});
116 + * }
117 + * }, function(err, results) {
118 + * console.log('err = ', err);
119 + * console.log('email_link = ', results.email_link);
120 + * });
121 + *
122 + * // If you are using a JS minifier that mangles parameter names, `autoInject`
123 + * // will not work with plain functions, since the parameter names will be
124 + * // collapsed to a single letter identifier. To work around this, you can
125 + * // explicitly specify the names of the parameters your task function needs
126 + * // in an array, similar to Angular.js dependency injection.
127 + *
128 + * // This still has an advantage over plain `auto`, since the results a task
129 + * // depends on are still spread into arguments.
130 + * async.autoInject({
131 + * //...
132 + * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
133 + * callback(null, 'filename');
134 + * }],
135 + * email_link: ['write_file', function(write_file, callback) {
136 + * callback(null, {'file':write_file, 'email':'user@example.com'});
137 + * }]
138 + * //...
139 + * }, function(err, results) {
140 + * console.log('err = ', err);
141 + * console.log('email_link = ', results.email_link);
142 + * });
143 + */
144 +function autoInject(tasks, callback) {
145 + var newTasks = {};
146 +
147 + Object.keys(tasks).forEach(key => {
148 + var taskFn = tasks[key];
149 + var params;
150 + var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn);
151 + var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0;
152 +
153 + if (Array.isArray(taskFn)) {
154 + params = [...taskFn];
155 + taskFn = params.pop();
156 +
157 + newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
158 + } else if (hasNoDeps) {
159 + // no dependencies, use the function as-is
160 + newTasks[key] = taskFn;
161 + } else {
162 + params = parseParams(taskFn);
163 + if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
164 + throw new Error("autoInject task functions require explicit parameters.");
165 + }
166 +
167 + // remove callback param
168 + if (!fnIsAsync) params.pop();
169 +
170 + newTasks[key] = params.concat(newTask);
171 + }
172 +
173 + function newTask(results, taskCb) {
174 + var newArgs = params.map(name => results[name]);
175 + newArgs.push(taskCb);
176 + (0, _wrapAsync2.default)(taskFn)(...newArgs);
177 + }
178 + });
179 +
180 + return (0, _auto2.default)(newTasks, callback);
181 +}
182 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "async",
3 + "main": "dist/async.js",
4 + "ignore": [
5 + "bower_components",
6 + "lib",
7 + "test",
8 + "node_modules",
9 + "perf",
10 + "support",
11 + "**/.*",
12 + "*.config.js",
13 + "*.json",
14 + "index.js",
15 + "Makefile"
16 + ]
17 +}
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = cargo;
7 +
8 +var _queue = require('./internal/queue.js');
9 +
10 +var _queue2 = _interopRequireDefault(_queue);
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Creates a `cargo` object with the specified payload. Tasks added to the
16 + * cargo will be processed altogether (up to the `payload` limit). If the
17 + * `worker` is in progress, the task is queued until it becomes available. Once
18 + * the `worker` has completed some tasks, each callback of those tasks is
19 + * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
20 + * for how `cargo` and `queue` work.
21 + *
22 + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
23 + * at a time, cargo passes an array of tasks to a single worker, repeating
24 + * when the worker is finished.
25 + *
26 + * @name cargo
27 + * @static
28 + * @memberOf module:ControlFlow
29 + * @method
30 + * @see [async.queue]{@link module:ControlFlow.queue}
31 + * @category Control Flow
32 + * @param {AsyncFunction} worker - An asynchronous function for processing an array
33 + * of queued tasks. Invoked with `(tasks, callback)`.
34 + * @param {number} [payload=Infinity] - An optional `integer` for determining
35 + * how many tasks should be processed per round; if omitted, the default is
36 + * unlimited.
37 + * @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can
38 + * attached as certain properties to listen for specific events during the
39 + * lifecycle of the cargo and inner queue.
40 + * @example
41 + *
42 + * // create a cargo object with payload 2
43 + * var cargo = async.cargo(function(tasks, callback) {
44 + * for (var i=0; i<tasks.length; i++) {
45 + * console.log('hello ' + tasks[i].name);
46 + * }
47 + * callback();
48 + * }, 2);
49 + *
50 + * // add some items
51 + * cargo.push({name: 'foo'}, function(err) {
52 + * console.log('finished processing foo');
53 + * });
54 + * cargo.push({name: 'bar'}, function(err) {
55 + * console.log('finished processing bar');
56 + * });
57 + * await cargo.push({name: 'baz'});
58 + * console.log('finished processing baz');
59 + */
60 +function cargo(worker, payload) {
61 + return (0, _queue2.default)(worker, 1, payload);
62 +}
63 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = cargo;
7 +
8 +var _queue = require('./internal/queue.js');
9 +
10 +var _queue2 = _interopRequireDefault(_queue);
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Creates a `cargoQueue` object with the specified payload. Tasks added to the
16 + * cargoQueue will be processed together (up to the `payload` limit) in `concurrency` parallel workers.
17 + * If the all `workers` are in progress, the task is queued until one becomes available. Once
18 + * a `worker` has completed some tasks, each callback of those tasks is
19 + * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
20 + * for how `cargo` and `queue` work.
21 + *
22 + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
23 + * at a time, and [`cargo`]{@link module:ControlFlow.cargo} passes an array of tasks to a single worker,
24 + * the cargoQueue passes an array of tasks to multiple parallel workers.
25 + *
26 + * @name cargoQueue
27 + * @static
28 + * @memberOf module:ControlFlow
29 + * @method
30 + * @see [async.queue]{@link module:ControlFlow.queue}
31 + * @see [async.cargo]{@link module:ControlFLow.cargo}
32 + * @category Control Flow
33 + * @param {AsyncFunction} worker - An asynchronous function for processing an array
34 + * of queued tasks. Invoked with `(tasks, callback)`.
35 + * @param {number} [concurrency=1] - An `integer` for determining how many
36 + * `worker` functions should be run in parallel. If omitted, the concurrency
37 + * defaults to `1`. If the concurrency is `0`, an error is thrown.
38 + * @param {number} [payload=Infinity] - An optional `integer` for determining
39 + * how many tasks should be processed per round; if omitted, the default is
40 + * unlimited.
41 + * @returns {module:ControlFlow.QueueObject} A cargoQueue object to manage the tasks. Callbacks can
42 + * attached as certain properties to listen for specific events during the
43 + * lifecycle of the cargoQueue and inner queue.
44 + * @example
45 + *
46 + * // create a cargoQueue object with payload 2 and concurrency 2
47 + * var cargoQueue = async.cargoQueue(function(tasks, callback) {
48 + * for (var i=0; i<tasks.length; i++) {
49 + * console.log('hello ' + tasks[i].name);
50 + * }
51 + * callback();
52 + * }, 2, 2);
53 + *
54 + * // add some items
55 + * cargoQueue.push({name: 'foo'}, function(err) {
56 + * console.log('finished processing foo');
57 + * });
58 + * cargoQueue.push({name: 'bar'}, function(err) {
59 + * console.log('finished processing bar');
60 + * });
61 + * cargoQueue.push({name: 'baz'}, function(err) {
62 + * console.log('finished processing baz');
63 + * });
64 + * cargoQueue.push({name: 'boo'}, function(err) {
65 + * console.log('finished processing boo');
66 + * });
67 + */
68 +function cargo(worker, concurrency, payload) {
69 + return (0, _queue2.default)(worker, concurrency, payload);
70 +}
71 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = compose;
7 +
8 +var _seq = require('./seq.js');
9 +
10 +var _seq2 = _interopRequireDefault(_seq);
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Creates a function which is a composition of the passed asynchronous
16 + * functions. Each function consumes the return value of the function that
17 + * follows. Composing functions `f()`, `g()`, and `h()` would produce the result
18 + * of `f(g(h()))`, only this version uses callbacks to obtain the return values.
19 + *
20 + * If the last argument to the composed function is not a function, a promise
21 + * is returned when you call it.
22 + *
23 + * Each function is executed with the `this` binding of the composed function.
24 + *
25 + * @name compose
26 + * @static
27 + * @memberOf module:ControlFlow
28 + * @method
29 + * @category Control Flow
30 + * @param {...AsyncFunction} functions - the asynchronous functions to compose
31 + * @returns {Function} an asynchronous function that is the composed
32 + * asynchronous `functions`
33 + * @example
34 + *
35 + * function add1(n, callback) {
36 + * setTimeout(function () {
37 + * callback(null, n + 1);
38 + * }, 10);
39 + * }
40 + *
41 + * function mul3(n, callback) {
42 + * setTimeout(function () {
43 + * callback(null, n * 3);
44 + * }, 10);
45 + * }
46 + *
47 + * var add1mul3 = async.compose(mul3, add1);
48 + * add1mul3(4, function (err, result) {
49 + * // result now equals 15
50 + * });
51 + */
52 +function compose(...args) {
53 + return (0, _seq2.default)(...args.reverse());
54 +}
55 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _concatLimit = require('./concatLimit.js');
8 +
9 +var _concatLimit2 = _interopRequireDefault(_concatLimit);
10 +
11 +var _awaitify = require('./internal/awaitify.js');
12 +
13 +var _awaitify2 = _interopRequireDefault(_awaitify);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * Applies `iteratee` to each item in `coll`, concatenating the results. Returns
19 + * the concatenated list. The `iteratee`s are called in parallel, and the
20 + * results are concatenated as they return. The results array will be returned in
21 + * the original order of `coll` passed to the `iteratee` function.
22 + *
23 + * @name concat
24 + * @static
25 + * @memberOf module:Collections
26 + * @method
27 + * @category Collection
28 + * @alias flatMap
29 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
30 + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
31 + * which should use an array as its result. Invoked with (item, callback).
32 + * @param {Function} [callback] - A callback which is called after all the
33 + * `iteratee` functions have finished, or an error occurs. Results is an array
34 + * containing the concatenated results of the `iteratee` function. Invoked with
35 + * (err, results).
36 + * @returns A Promise, if no callback is passed
37 + * @example
38 + *
39 + * // dir1 is a directory that contains file1.txt, file2.txt
40 + * // dir2 is a directory that contains file3.txt, file4.txt
41 + * // dir3 is a directory that contains file5.txt
42 + * // dir4 does not exist
43 + *
44 + * let directoryList = ['dir1','dir2','dir3'];
45 + * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
46 + *
47 + * // Using callbacks
48 + * async.concat(directoryList, fs.readdir, function(err, results) {
49 + * if (err) {
50 + * console.log(err);
51 + * } else {
52 + * console.log(results);
53 + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
54 + * }
55 + * });
56 + *
57 + * // Error Handling
58 + * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
59 + * if (err) {
60 + * console.log(err);
61 + * // [ Error: ENOENT: no such file or directory ]
62 + * // since dir4 does not exist
63 + * } else {
64 + * console.log(results);
65 + * }
66 + * });
67 + *
68 + * // Using Promises
69 + * async.concat(directoryList, fs.readdir)
70 + * .then(results => {
71 + * console.log(results);
72 + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
73 + * }).catch(err => {
74 + * console.log(err);
75 + * });
76 + *
77 + * // Error Handling
78 + * async.concat(withMissingDirectoryList, fs.readdir)
79 + * .then(results => {
80 + * console.log(results);
81 + * }).catch(err => {
82 + * console.log(err);
83 + * // [ Error: ENOENT: no such file or directory ]
84 + * // since dir4 does not exist
85 + * });
86 + *
87 + * // Using async/await
88 + * async () => {
89 + * try {
90 + * let results = await async.concat(directoryList, fs.readdir);
91 + * console.log(results);
92 + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
93 + * } catch (err) {
94 + * console.log(err);
95 + * }
96 + * }
97 + *
98 + * // Error Handling
99 + * async () => {
100 + * try {
101 + * let results = await async.concat(withMissingDirectoryList, fs.readdir);
102 + * console.log(results);
103 + * } catch (err) {
104 + * console.log(err);
105 + * // [ Error: ENOENT: no such file or directory ]
106 + * // since dir4 does not exist
107 + * }
108 + * }
109 + *
110 + */
111 +function concat(coll, iteratee, callback) {
112 + return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
113 +}
114 +exports.default = (0, _awaitify2.default)(concat, 3);
115 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _wrapAsync = require('./internal/wrapAsync.js');
8 +
9 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
10 +
11 +var _mapLimit = require('./mapLimit.js');
12 +
13 +var _mapLimit2 = _interopRequireDefault(_mapLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
23 + *
24 + * @name concatLimit
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.concat]{@link module:Collections.concat}
29 + * @category Collection
30 + * @alias flatMapLimit
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {number} limit - The maximum number of async operations at a time.
33 + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
34 + * which should use an array as its result. Invoked with (item, callback).
35 + * @param {Function} [callback] - A callback which is called after all the
36 + * `iteratee` functions have finished, or an error occurs. Results is an array
37 + * containing the concatenated results of the `iteratee` function. Invoked with
38 + * (err, results).
39 + * @returns A Promise, if no callback is passed
40 + */
41 +function concatLimit(coll, limit, iteratee, callback) {
42 + var _iteratee = (0, _wrapAsync2.default)(iteratee);
43 + return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
44 + _iteratee(val, (err, ...args) => {
45 + if (err) return iterCb(err);
46 + return iterCb(err, args);
47 + });
48 + }, (err, mapResults) => {
49 + var result = [];
50 + for (var i = 0; i < mapResults.length; i++) {
51 + if (mapResults[i]) {
52 + result = result.concat(...mapResults[i]);
53 + }
54 + }
55 +
56 + return callback(err, result);
57 + });
58 +}
59 +exports.default = (0, _awaitify2.default)(concatLimit, 4);
60 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _concatLimit = require('./concatLimit.js');
8 +
9 +var _concatLimit2 = _interopRequireDefault(_concatLimit);
10 +
11 +var _awaitify = require('./internal/awaitify.js');
12 +
13 +var _awaitify2 = _interopRequireDefault(_awaitify);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
19 + *
20 + * @name concatSeries
21 + * @static
22 + * @memberOf module:Collections
23 + * @method
24 + * @see [async.concat]{@link module:Collections.concat}
25 + * @category Collection
26 + * @alias flatMapSeries
27 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
28 + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
29 + * The iteratee should complete with an array an array of results.
30 + * Invoked with (item, callback).
31 + * @param {Function} [callback] - A callback which is called after all the
32 + * `iteratee` functions have finished, or an error occurs. Results is an array
33 + * containing the concatenated results of the `iteratee` function. Invoked with
34 + * (err, results).
35 + * @returns A Promise, if no callback is passed
36 + */
37 +function concatSeries(coll, iteratee, callback) {
38 + return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
39 +}
40 +exports.default = (0, _awaitify2.default)(concatSeries, 3);
41 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict";
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +exports.default = function (...args) {
8 + return function (...ignoredArgs /*, callback*/) {
9 + var callback = ignoredArgs.pop();
10 + return callback(null, ...args);
11 + };
12 +};
13 +
14 +module.exports = exports["default"]; /**
15 + * Returns a function that when called, calls-back with the values provided.
16 + * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
17 + * [`auto`]{@link module:ControlFlow.auto}.
18 + *
19 + * @name constant
20 + * @static
21 + * @memberOf module:Utils
22 + * @method
23 + * @category Util
24 + * @param {...*} arguments... - Any number of arguments to automatically invoke
25 + * callback with.
26 + * @returns {AsyncFunction} Returns a function that when invoked, automatically
27 + * invokes the callback with the previous given arguments.
28 + * @example
29 + *
30 + * async.waterfall([
31 + * async.constant(42),
32 + * function (value, next) {
33 + * // value === 42
34 + * },
35 + * //...
36 + * ], callback);
37 + *
38 + * async.waterfall([
39 + * async.constant(filename, "utf8"),
40 + * fs.readFile,
41 + * function (fileData, next) {
42 + * //...
43 + * }
44 + * //...
45 + * ], callback);
46 + *
47 + * async.auto({
48 + * hostname: async.constant("https://server.net/"),
49 + * port: findFreePort,
50 + * launchServer: ["hostname", "port", function (options, cb) {
51 + * startServer(options, cb);
52 + * }],
53 + * //...
54 + * }, callback);
55 + */
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOf = require('./eachOf.js');
12 +
13 +var _eachOf2 = _interopRequireDefault(_eachOf);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Returns the first value in `coll` that passes an async truth test. The
23 + * `iteratee` is applied in parallel, meaning the first iteratee to return
24 + * `true` will fire the detect `callback` with that result. That means the
25 + * result might not be the first item in the original `coll` (in terms of order)
26 + * that passes the test.
27 +
28 + * If order within the original `coll` is important, then look at
29 + * [`detectSeries`]{@link module:Collections.detectSeries}.
30 + *
31 + * @name detect
32 + * @static
33 + * @memberOf module:Collections
34 + * @method
35 + * @alias find
36 + * @category Collections
37 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
38 + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
39 + * The iteratee must complete with a boolean value as its result.
40 + * Invoked with (item, callback).
41 + * @param {Function} [callback] - A callback which is called as soon as any
42 + * iteratee returns `true`, or after all the `iteratee` functions have finished.
43 + * Result will be the first item in the array that passes the truth test
44 + * (iteratee) or the value `undefined` if none passed. Invoked with
45 + * (err, result).
46 + * @returns A Promise, if no callback is passed
47 + * @example
48 + *
49 + * // dir1 is a directory that contains file1.txt, file2.txt
50 + * // dir2 is a directory that contains file3.txt, file4.txt
51 + * // dir3 is a directory that contains file5.txt
52 + *
53 + * // asynchronous function that checks if a file exists
54 + * function fileExists(file, callback) {
55 + * fs.access(file, fs.constants.F_OK, (err) => {
56 + * callback(null, !err);
57 + * });
58 + * }
59 + *
60 + * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
61 + * function(err, result) {
62 + * console.log(result);
63 + * // dir1/file1.txt
64 + * // result now equals the first file in the list that exists
65 + * }
66 + *);
67 + *
68 + * // Using Promises
69 + * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
70 + * .then(result => {
71 + * console.log(result);
72 + * // dir1/file1.txt
73 + * // result now equals the first file in the list that exists
74 + * }).catch(err => {
75 + * console.log(err);
76 + * });
77 + *
78 + * // Using async/await
79 + * async () => {
80 + * try {
81 + * let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
82 + * console.log(result);
83 + * // dir1/file1.txt
84 + * // result now equals the file in the list that exists
85 + * }
86 + * catch (err) {
87 + * console.log(err);
88 + * }
89 + * }
90 + *
91 + */
92 +function detect(coll, iteratee, callback) {
93 + return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback);
94 +}
95 +exports.default = (0, _awaitify2.default)(detect, 3);
96 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
23 + * time.
24 + *
25 + * @name detectLimit
26 + * @static
27 + * @memberOf module:Collections
28 + * @method
29 + * @see [async.detect]{@link module:Collections.detect}
30 + * @alias findLimit
31 + * @category Collections
32 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 + * @param {number} limit - The maximum number of async operations at a time.
34 + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
35 + * The iteratee must complete with a boolean value as its result.
36 + * Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called as soon as any
38 + * iteratee returns `true`, or after all the `iteratee` functions have finished.
39 + * Result will be the first item in the array that passes the truth test
40 + * (iteratee) or the value `undefined` if none passed. Invoked with
41 + * (err, result).
42 + * @returns a Promise if no callback is passed
43 + */
44 +function detectLimit(coll, limit, iteratee, callback) {
45 + return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
46 +}
47 +exports.default = (0, _awaitify2.default)(detectLimit, 4);
48 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
23 + *
24 + * @name detectSeries
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.detect]{@link module:Collections.detect}
29 + * @alias findSeries
30 + * @category Collections
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
33 + * The iteratee must complete with a boolean value as its result.
34 + * Invoked with (item, callback).
35 + * @param {Function} [callback] - A callback which is called as soon as any
36 + * iteratee returns `true`, or after all the `iteratee` functions have finished.
37 + * Result will be the first item in the array that passes the truth test
38 + * (iteratee) or the value `undefined` if none passed. Invoked with
39 + * (err, result).
40 + * @returns a Promise if no callback is passed
41 + */
42 +function detectSeries(coll, iteratee, callback) {
43 + return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback);
44 +}
45 +
46 +exports.default = (0, _awaitify2.default)(detectSeries, 3);
47 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _consoleFunc = require('./internal/consoleFunc.js');
8 +
9 +var _consoleFunc2 = _interopRequireDefault(_consoleFunc);
10 +
11 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12 +
13 +/**
14 + * Logs the result of an [`async` function]{@link AsyncFunction} to the
15 + * `console` using `console.dir` to display the properties of the resulting object.
16 + * Only works in Node.js or in browsers that support `console.dir` and
17 + * `console.error` (such as FF and Chrome).
18 + * If multiple arguments are returned from the async function,
19 + * `console.dir` is called on each argument in order.
20 + *
21 + * @name dir
22 + * @static
23 + * @memberOf module:Utils
24 + * @method
25 + * @category Util
26 + * @param {AsyncFunction} function - The function you want to eventually apply
27 + * all arguments to.
28 + * @param {...*} arguments... - Any number of arguments to apply to the function.
29 + * @example
30 + *
31 + * // in a module
32 + * var hello = function(name, callback) {
33 + * setTimeout(function() {
34 + * callback(null, {hello: name});
35 + * }, 1000);
36 + * };
37 + *
38 + * // in the node repl
39 + * node> async.dir(hello, 'world');
40 + * {hello: 'world'}
41 + */
42 +exports.default = (0, _consoleFunc2.default)('dir');
43 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _onlyOnce = require('./internal/onlyOnce.js');
8 +
9 +var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
10 +
11 +var _wrapAsync = require('./internal/wrapAsync.js');
12 +
13 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
23 + * the order of operations, the arguments `test` and `iteratee` are switched.
24 + *
25 + * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
26 + *
27 + * @name doWhilst
28 + * @static
29 + * @memberOf module:ControlFlow
30 + * @method
31 + * @see [async.whilst]{@link module:ControlFlow.whilst}
32 + * @category Control Flow
33 + * @param {AsyncFunction} iteratee - A function which is called each time `test`
34 + * passes. Invoked with (callback).
35 + * @param {AsyncFunction} test - asynchronous truth test to perform after each
36 + * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
37 + * non-error args from the previous callback of `iteratee`.
38 + * @param {Function} [callback] - A callback which is called after the test
39 + * function has failed and repeated execution of `iteratee` has stopped.
40 + * `callback` will be passed an error and any arguments passed to the final
41 + * `iteratee`'s callback. Invoked with (err, [results]);
42 + * @returns {Promise} a promise, if no callback is passed
43 + */
44 +function doWhilst(iteratee, test, callback) {
45 + callback = (0, _onlyOnce2.default)(callback);
46 + var _fn = (0, _wrapAsync2.default)(iteratee);
47 + var _test = (0, _wrapAsync2.default)(test);
48 + var results;
49 +
50 + function next(err, ...args) {
51 + if (err) return callback(err);
52 + if (err === false) return;
53 + results = args;
54 + _test(...args, check);
55 + }
56 +
57 + function check(err, truth) {
58 + if (err) return callback(err);
59 + if (err === false) return;
60 + if (!truth) return callback(null, ...results);
61 + _fn(next);
62 + }
63 +
64 + return check(null, true);
65 +}
66 +
67 +exports.default = (0, _awaitify2.default)(doWhilst, 3);
68 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = doUntil;
7 +
8 +var _doWhilst = require('./doWhilst.js');
9 +
10 +var _doWhilst2 = _interopRequireDefault(_doWhilst);
11 +
12 +var _wrapAsync = require('./internal/wrapAsync.js');
13 +
14 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15 +
16 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 +
18 +/**
19 + * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
20 + * argument ordering differs from `until`.
21 + *
22 + * @name doUntil
23 + * @static
24 + * @memberOf module:ControlFlow
25 + * @method
26 + * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
27 + * @category Control Flow
28 + * @param {AsyncFunction} iteratee - An async function which is called each time
29 + * `test` fails. Invoked with (callback).
30 + * @param {AsyncFunction} test - asynchronous truth test to perform after each
31 + * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
32 + * non-error args from the previous callback of `iteratee`
33 + * @param {Function} [callback] - A callback which is called after the test
34 + * function has passed and repeated execution of `iteratee` has stopped. `callback`
35 + * will be passed an error and any arguments passed to the final `iteratee`'s
36 + * callback. Invoked with (err, [results]);
37 + * @returns {Promise} a promise, if no callback is passed
38 + */
39 +function doUntil(iteratee, test, callback) {
40 + const _test = (0, _wrapAsync2.default)(test);
41 + return (0, _doWhilst2.default)(iteratee, (...args) => {
42 + const cb = args.pop();
43 + _test(...args, (err, truth) => cb(err, !truth));
44 + }, callback);
45 +}
46 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _onlyOnce = require('./internal/onlyOnce.js');
8 +
9 +var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
10 +
11 +var _wrapAsync = require('./internal/wrapAsync.js');
12 +
13 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
23 + * the order of operations, the arguments `test` and `iteratee` are switched.
24 + *
25 + * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
26 + *
27 + * @name doWhilst
28 + * @static
29 + * @memberOf module:ControlFlow
30 + * @method
31 + * @see [async.whilst]{@link module:ControlFlow.whilst}
32 + * @category Control Flow
33 + * @param {AsyncFunction} iteratee - A function which is called each time `test`
34 + * passes. Invoked with (callback).
35 + * @param {AsyncFunction} test - asynchronous truth test to perform after each
36 + * execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
37 + * non-error args from the previous callback of `iteratee`.
38 + * @param {Function} [callback] - A callback which is called after the test
39 + * function has failed and repeated execution of `iteratee` has stopped.
40 + * `callback` will be passed an error and any arguments passed to the final
41 + * `iteratee`'s callback. Invoked with (err, [results]);
42 + * @returns {Promise} a promise, if no callback is passed
43 + */
44 +function doWhilst(iteratee, test, callback) {
45 + callback = (0, _onlyOnce2.default)(callback);
46 + var _fn = (0, _wrapAsync2.default)(iteratee);
47 + var _test = (0, _wrapAsync2.default)(test);
48 + var results;
49 +
50 + function next(err, ...args) {
51 + if (err) return callback(err);
52 + if (err === false) return;
53 + results = args;
54 + _test(...args, check);
55 + }
56 +
57 + function check(err, truth) {
58 + if (err) return callback(err);
59 + if (err === false) return;
60 + if (!truth) return callback(null, ...results);
61 + _fn(next);
62 + }
63 +
64 + return check(null, true);
65 +}
66 +
67 +exports.default = (0, _awaitify2.default)(doWhilst, 3);
68 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _onlyOnce = require('./internal/onlyOnce.js');
8 +
9 +var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
10 +
11 +var _wrapAsync = require('./internal/wrapAsync.js');
12 +
13 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
23 + * stopped, or an error occurs.
24 + *
25 + * @name whilst
26 + * @static
27 + * @memberOf module:ControlFlow
28 + * @method
29 + * @category Control Flow
30 + * @param {AsyncFunction} test - asynchronous truth test to perform before each
31 + * execution of `iteratee`. Invoked with ().
32 + * @param {AsyncFunction} iteratee - An async function which is called each time
33 + * `test` passes. Invoked with (callback).
34 + * @param {Function} [callback] - A callback which is called after the test
35 + * function has failed and repeated execution of `iteratee` has stopped. `callback`
36 + * will be passed an error and any arguments passed to the final `iteratee`'s
37 + * callback. Invoked with (err, [results]);
38 + * @returns {Promise} a promise, if no callback is passed
39 + * @example
40 + *
41 + * var count = 0;
42 + * async.whilst(
43 + * function test(cb) { cb(null, count < 5); },
44 + * function iter(callback) {
45 + * count++;
46 + * setTimeout(function() {
47 + * callback(null, count);
48 + * }, 1000);
49 + * },
50 + * function (err, n) {
51 + * // 5 seconds have passed, n = 5
52 + * }
53 + * );
54 + */
55 +function whilst(test, iteratee, callback) {
56 + callback = (0, _onlyOnce2.default)(callback);
57 + var _fn = (0, _wrapAsync2.default)(iteratee);
58 + var _test = (0, _wrapAsync2.default)(test);
59 + var results = [];
60 +
61 + function next(err, ...rest) {
62 + if (err) return callback(err);
63 + results = rest;
64 + if (err === false) return;
65 + _test(check);
66 + }
67 +
68 + function check(err, truth) {
69 + if (err) return callback(err);
70 + if (err === false) return;
71 + if (!truth) return callback(null, ...results);
72 + _fn(next);
73 + }
74 +
75 + return _test(check);
76 +}
77 +exports.default = (0, _awaitify2.default)(whilst, 3);
78 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOf = require('./eachOf.js');
8 +
9 +var _eachOf2 = _interopRequireDefault(_eachOf);
10 +
11 +var _withoutIndex = require('./internal/withoutIndex.js');
12 +
13 +var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
14 +
15 +var _wrapAsync = require('./internal/wrapAsync.js');
16 +
17 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18 +
19 +var _awaitify = require('./internal/awaitify.js');
20 +
21 +var _awaitify2 = _interopRequireDefault(_awaitify);
22 +
23 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 +
25 +/**
26 + * Applies the function `iteratee` to each item in `coll`, in parallel.
27 + * The `iteratee` is called with an item from the list, and a callback for when
28 + * it has finished. If the `iteratee` passes an error to its `callback`, the
29 + * main `callback` (for the `each` function) is immediately called with the
30 + * error.
31 + *
32 + * Note, that since this function applies `iteratee` to each item in parallel,
33 + * there is no guarantee that the iteratee functions will complete in order.
34 + *
35 + * @name each
36 + * @static
37 + * @memberOf module:Collections
38 + * @method
39 + * @alias forEach
40 + * @category Collection
41 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
42 + * @param {AsyncFunction} iteratee - An async function to apply to
43 + * each item in `coll`. Invoked with (item, callback).
44 + * The array index is not passed to the iteratee.
45 + * If you need the index, use `eachOf`.
46 + * @param {Function} [callback] - A callback which is called when all
47 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
48 + * @returns {Promise} a promise, if a callback is omitted
49 + * @example
50 + *
51 + * // dir1 is a directory that contains file1.txt, file2.txt
52 + * // dir2 is a directory that contains file3.txt, file4.txt
53 + * // dir3 is a directory that contains file5.txt
54 + * // dir4 does not exist
55 + *
56 + * const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
57 + * const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
58 + *
59 + * // asynchronous function that deletes a file
60 + * const deleteFile = function(file, callback) {
61 + * fs.unlink(file, callback);
62 + * };
63 + *
64 + * // Using callbacks
65 + * async.each(fileList, deleteFile, function(err) {
66 + * if( err ) {
67 + * console.log(err);
68 + * } else {
69 + * console.log('All files have been deleted successfully');
70 + * }
71 + * });
72 + *
73 + * // Error Handling
74 + * async.each(withMissingFileList, deleteFile, function(err){
75 + * console.log(err);
76 + * // [ Error: ENOENT: no such file or directory ]
77 + * // since dir4/file2.txt does not exist
78 + * // dir1/file1.txt could have been deleted
79 + * });
80 + *
81 + * // Using Promises
82 + * async.each(fileList, deleteFile)
83 + * .then( () => {
84 + * console.log('All files have been deleted successfully');
85 + * }).catch( err => {
86 + * console.log(err);
87 + * });
88 + *
89 + * // Error Handling
90 + * async.each(fileList, deleteFile)
91 + * .then( () => {
92 + * console.log('All files have been deleted successfully');
93 + * }).catch( err => {
94 + * console.log(err);
95 + * // [ Error: ENOENT: no such file or directory ]
96 + * // since dir4/file2.txt does not exist
97 + * // dir1/file1.txt could have been deleted
98 + * });
99 + *
100 + * // Using async/await
101 + * async () => {
102 + * try {
103 + * await async.each(files, deleteFile);
104 + * }
105 + * catch (err) {
106 + * console.log(err);
107 + * }
108 + * }
109 + *
110 + * // Error Handling
111 + * async () => {
112 + * try {
113 + * await async.each(withMissingFileList, deleteFile);
114 + * }
115 + * catch (err) {
116 + * console.log(err);
117 + * // [ Error: ENOENT: no such file or directory ]
118 + * // since dir4/file2.txt does not exist
119 + * // dir1/file1.txt could have been deleted
120 + * }
121 + * }
122 + *
123 + */
124 +function eachLimit(coll, iteratee, callback) {
125 + return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
126 +}
127 +
128 +exports.default = (0, _awaitify2.default)(eachLimit, 3);
129 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOfLimit = require('./internal/eachOfLimit.js');
8 +
9 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
10 +
11 +var _withoutIndex = require('./internal/withoutIndex.js');
12 +
13 +var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
14 +
15 +var _wrapAsync = require('./internal/wrapAsync.js');
16 +
17 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18 +
19 +var _awaitify = require('./internal/awaitify.js');
20 +
21 +var _awaitify2 = _interopRequireDefault(_awaitify);
22 +
23 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 +
25 +/**
26 + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
27 + *
28 + * @name eachLimit
29 + * @static
30 + * @memberOf module:Collections
31 + * @method
32 + * @see [async.each]{@link module:Collections.each}
33 + * @alias forEachLimit
34 + * @category Collection
35 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
36 + * @param {number} limit - The maximum number of async operations at a time.
37 + * @param {AsyncFunction} iteratee - An async function to apply to each item in
38 + * `coll`.
39 + * The array index is not passed to the iteratee.
40 + * If you need the index, use `eachOfLimit`.
41 + * Invoked with (item, callback).
42 + * @param {Function} [callback] - A callback which is called when all
43 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
44 + * @returns {Promise} a promise, if a callback is omitted
45 + */
46 +function eachLimit(coll, limit, iteratee, callback) {
47 + return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
48 +}
49 +exports.default = (0, _awaitify2.default)(eachLimit, 4);
50 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _isArrayLike = require('./internal/isArrayLike.js');
8 +
9 +var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
10 +
11 +var _breakLoop = require('./internal/breakLoop.js');
12 +
13 +var _breakLoop2 = _interopRequireDefault(_breakLoop);
14 +
15 +var _eachOfLimit = require('./eachOfLimit.js');
16 +
17 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
18 +
19 +var _once = require('./internal/once.js');
20 +
21 +var _once2 = _interopRequireDefault(_once);
22 +
23 +var _onlyOnce = require('./internal/onlyOnce.js');
24 +
25 +var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
26 +
27 +var _wrapAsync = require('./internal/wrapAsync.js');
28 +
29 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
30 +
31 +var _awaitify = require('./internal/awaitify.js');
32 +
33 +var _awaitify2 = _interopRequireDefault(_awaitify);
34 +
35 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36 +
37 +// eachOf implementation optimized for array-likes
38 +function eachOfArrayLike(coll, iteratee, callback) {
39 + callback = (0, _once2.default)(callback);
40 + var index = 0,
41 + completed = 0,
42 + { length } = coll,
43 + canceled = false;
44 + if (length === 0) {
45 + callback(null);
46 + }
47 +
48 + function iteratorCallback(err, value) {
49 + if (err === false) {
50 + canceled = true;
51 + }
52 + if (canceled === true) return;
53 + if (err) {
54 + callback(err);
55 + } else if (++completed === length || value === _breakLoop2.default) {
56 + callback(null);
57 + }
58 + }
59 +
60 + for (; index < length; index++) {
61 + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback));
62 + }
63 +}
64 +
65 +// a generic version of eachOf which can handle array, object, and iterator cases.
66 +function eachOfGeneric(coll, iteratee, callback) {
67 + return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback);
68 +}
69 +
70 +/**
71 + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
72 + * to the iteratee.
73 + *
74 + * @name eachOf
75 + * @static
76 + * @memberOf module:Collections
77 + * @method
78 + * @alias forEachOf
79 + * @category Collection
80 + * @see [async.each]{@link module:Collections.each}
81 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
82 + * @param {AsyncFunction} iteratee - A function to apply to each
83 + * item in `coll`.
84 + * The `key` is the item's key, or index in the case of an array.
85 + * Invoked with (item, key, callback).
86 + * @param {Function} [callback] - A callback which is called when all
87 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
88 + * @returns {Promise} a promise, if a callback is omitted
89 + * @example
90 + *
91 + * // dev.json is a file containing a valid json object config for dev environment
92 + * // dev.json is a file containing a valid json object config for test environment
93 + * // prod.json is a file containing a valid json object config for prod environment
94 + * // invalid.json is a file with a malformed json object
95 + *
96 + * let configs = {}; //global variable
97 + * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
98 + * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
99 + *
100 + * // asynchronous function that reads a json file and parses the contents as json object
101 + * function parseFile(file, key, callback) {
102 + * fs.readFile(file, "utf8", function(err, data) {
103 + * if (err) return calback(err);
104 + * try {
105 + * configs[key] = JSON.parse(data);
106 + * } catch (e) {
107 + * return callback(e);
108 + * }
109 + * callback();
110 + * });
111 + * }
112 + *
113 + * // Using callbacks
114 + * async.forEachOf(validConfigFileMap, parseFile, function (err) {
115 + * if (err) {
116 + * console.error(err);
117 + * } else {
118 + * console.log(configs);
119 + * // configs is now a map of JSON data, e.g.
120 + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
121 + * }
122 + * });
123 + *
124 + * //Error handing
125 + * async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
126 + * if (err) {
127 + * console.error(err);
128 + * // JSON parse error exception
129 + * } else {
130 + * console.log(configs);
131 + * }
132 + * });
133 + *
134 + * // Using Promises
135 + * async.forEachOf(validConfigFileMap, parseFile)
136 + * .then( () => {
137 + * console.log(configs);
138 + * // configs is now a map of JSON data, e.g.
139 + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
140 + * }).catch( err => {
141 + * console.error(err);
142 + * });
143 + *
144 + * //Error handing
145 + * async.forEachOf(invalidConfigFileMap, parseFile)
146 + * .then( () => {
147 + * console.log(configs);
148 + * }).catch( err => {
149 + * console.error(err);
150 + * // JSON parse error exception
151 + * });
152 + *
153 + * // Using async/await
154 + * async () => {
155 + * try {
156 + * let result = await async.forEachOf(validConfigFileMap, parseFile);
157 + * console.log(configs);
158 + * // configs is now a map of JSON data, e.g.
159 + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
160 + * }
161 + * catch (err) {
162 + * console.log(err);
163 + * }
164 + * }
165 + *
166 + * //Error handing
167 + * async () => {
168 + * try {
169 + * let result = await async.forEachOf(invalidConfigFileMap, parseFile);
170 + * console.log(configs);
171 + * }
172 + * catch (err) {
173 + * console.log(err);
174 + * // JSON parse error exception
175 + * }
176 + * }
177 + *
178 + */
179 +function eachOf(coll, iteratee, callback) {
180 + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric;
181 + return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback);
182 +}
183 +
184 +exports.default = (0, _awaitify2.default)(eachOf, 3);
185 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOfLimit2 = require('./internal/eachOfLimit.js');
8 +
9 +var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
10 +
11 +var _wrapAsync = require('./internal/wrapAsync.js');
12 +
13 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
23 + * time.
24 + *
25 + * @name eachOfLimit
26 + * @static
27 + * @memberOf module:Collections
28 + * @method
29 + * @see [async.eachOf]{@link module:Collections.eachOf}
30 + * @alias forEachOfLimit
31 + * @category Collection
32 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 + * @param {number} limit - The maximum number of async operations at a time.
34 + * @param {AsyncFunction} iteratee - An async function to apply to each
35 + * item in `coll`. The `key` is the item's key, or index in the case of an
36 + * array.
37 + * Invoked with (item, key, callback).
38 + * @param {Function} [callback] - A callback which is called when all
39 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
40 + * @returns {Promise} a promise, if a callback is omitted
41 + */
42 +function eachOfLimit(coll, limit, iteratee, callback) {
43 + return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback);
44 +}
45 +
46 +exports.default = (0, _awaitify2.default)(eachOfLimit, 4);
47 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOfLimit = require('./eachOfLimit.js');
8 +
9 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
10 +
11 +var _awaitify = require('./internal/awaitify.js');
12 +
13 +var _awaitify2 = _interopRequireDefault(_awaitify);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
19 + *
20 + * @name eachOfSeries
21 + * @static
22 + * @memberOf module:Collections
23 + * @method
24 + * @see [async.eachOf]{@link module:Collections.eachOf}
25 + * @alias forEachOfSeries
26 + * @category Collection
27 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
28 + * @param {AsyncFunction} iteratee - An async function to apply to each item in
29 + * `coll`.
30 + * Invoked with (item, key, callback).
31 + * @param {Function} [callback] - A callback which is called when all `iteratee`
32 + * functions have finished, or an error occurs. Invoked with (err).
33 + * @returns {Promise} a promise, if a callback is omitted
34 + */
35 +function eachOfSeries(coll, iteratee, callback) {
36 + return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback);
37 +}
38 +exports.default = (0, _awaitify2.default)(eachOfSeries, 3);
39 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachLimit = require('./eachLimit.js');
8 +
9 +var _eachLimit2 = _interopRequireDefault(_eachLimit);
10 +
11 +var _awaitify = require('./internal/awaitify.js');
12 +
13 +var _awaitify2 = _interopRequireDefault(_awaitify);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
19 + *
20 + * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item
21 + * in series and therefore the iteratee functions will complete in order.
22 +
23 + * @name eachSeries
24 + * @static
25 + * @memberOf module:Collections
26 + * @method
27 + * @see [async.each]{@link module:Collections.each}
28 + * @alias forEachSeries
29 + * @category Collection
30 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31 + * @param {AsyncFunction} iteratee - An async function to apply to each
32 + * item in `coll`.
33 + * The array index is not passed to the iteratee.
34 + * If you need the index, use `eachOfSeries`.
35 + * Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called when all
37 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
38 + * @returns {Promise} a promise, if a callback is omitted
39 + */
40 +function eachSeries(coll, iteratee, callback) {
41 + return (0, _eachLimit2.default)(coll, 1, iteratee, callback);
42 +}
43 +exports.default = (0, _awaitify2.default)(eachSeries, 3);
44 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = ensureAsync;
7 +
8 +var _setImmediate = require('./internal/setImmediate.js');
9 +
10 +var _setImmediate2 = _interopRequireDefault(_setImmediate);
11 +
12 +var _wrapAsync = require('./internal/wrapAsync.js');
13 +
14 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15 +
16 +/**
17 + * Wrap an async function and ensure it calls its callback on a later tick of
18 + * the event loop. If the function already calls its callback on a next tick,
19 + * no extra deferral is added. This is useful for preventing stack overflows
20 + * (`RangeError: Maximum call stack size exceeded`) and generally keeping
21 + * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
22 + * contained. ES2017 `async` functions are returned as-is -- they are immune
23 + * to Zalgo's corrupting influences, as they always resolve on a later tick.
24 + *
25 + * @name ensureAsync
26 + * @static
27 + * @memberOf module:Utils
28 + * @method
29 + * @category Util
30 + * @param {AsyncFunction} fn - an async function, one that expects a node-style
31 + * callback as its last argument.
32 + * @returns {AsyncFunction} Returns a wrapped function with the exact same call
33 + * signature as the function passed in.
34 + * @example
35 + *
36 + * function sometimesAsync(arg, callback) {
37 + * if (cache[arg]) {
38 + * return callback(null, cache[arg]); // this would be synchronous!!
39 + * } else {
40 + * doSomeIO(arg, callback); // this IO would be asynchronous
41 + * }
42 + * }
43 + *
44 + * // this has a risk of stack overflows if many results are cached in a row
45 + * async.mapSeries(args, sometimesAsync, done);
46 + *
47 + * // this will defer sometimesAsync's callback if necessary,
48 + * // preventing stack overflows
49 + * async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
50 + */
51 +function ensureAsync(fn) {
52 + if ((0, _wrapAsync.isAsync)(fn)) return fn;
53 + return function (...args /*, callback*/) {
54 + var callback = args.pop();
55 + var sync = true;
56 + args.push((...innerArgs) => {
57 + if (sync) {
58 + (0, _setImmediate2.default)(() => callback(...innerArgs));
59 + } else {
60 + callback(...innerArgs);
61 + }
62 + });
63 + fn.apply(this, args);
64 + sync = false;
65 + };
66 +}
67 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOf = require('./eachOf.js');
12 +
13 +var _eachOf2 = _interopRequireDefault(_eachOf);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Returns `true` if every element in `coll` satisfies an async test. If any
23 + * iteratee call returns `false`, the main `callback` is immediately called.
24 + *
25 + * @name every
26 + * @static
27 + * @memberOf module:Collections
28 + * @method
29 + * @alias all
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
33 + * in the collection in parallel.
34 + * The iteratee must complete with a boolean result value.
35 + * Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called after all the
37 + * `iteratee` functions have finished. Result will be either `true` or `false`
38 + * depending on the values of the async tests. Invoked with (err, result).
39 + * @returns {Promise} a promise, if no callback provided
40 + * @example
41 + *
42 + * // dir1 is a directory that contains file1.txt, file2.txt
43 + * // dir2 is a directory that contains file3.txt, file4.txt
44 + * // dir3 is a directory that contains file5.txt
45 + * // dir4 does not exist
46 + *
47 + * const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
48 + * const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
49 + *
50 + * // asynchronous function that checks if a file exists
51 + * function fileExists(file, callback) {
52 + * fs.access(file, fs.constants.F_OK, (err) => {
53 + * callback(null, !err);
54 + * });
55 + * }
56 + *
57 + * // Using callbacks
58 + * async.every(fileList, fileExists, function(err, result) {
59 + * console.log(result);
60 + * // true
61 + * // result is true since every file exists
62 + * });
63 + *
64 + * async.every(withMissingFileList, fileExists, function(err, result) {
65 + * console.log(result);
66 + * // false
67 + * // result is false since NOT every file exists
68 + * });
69 + *
70 + * // Using Promises
71 + * async.every(fileList, fileExists)
72 + * .then( result => {
73 + * console.log(result);
74 + * // true
75 + * // result is true since every file exists
76 + * }).catch( err => {
77 + * console.log(err);
78 + * });
79 + *
80 + * async.every(withMissingFileList, fileExists)
81 + * .then( result => {
82 + * console.log(result);
83 + * // false
84 + * // result is false since NOT every file exists
85 + * }).catch( err => {
86 + * console.log(err);
87 + * });
88 + *
89 + * // Using async/await
90 + * async () => {
91 + * try {
92 + * let result = await async.every(fileList, fileExists);
93 + * console.log(result);
94 + * // true
95 + * // result is true since every file exists
96 + * }
97 + * catch (err) {
98 + * console.log(err);
99 + * }
100 + * }
101 + *
102 + * async () => {
103 + * try {
104 + * let result = await async.every(withMissingFileList, fileExists);
105 + * console.log(result);
106 + * // false
107 + * // result is false since NOT every file exists
108 + * }
109 + * catch (err) {
110 + * console.log(err);
111 + * }
112 + * }
113 + *
114 + */
115 +function every(coll, iteratee, callback) {
116 + return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
117 +}
118 +exports.default = (0, _awaitify2.default)(every, 3);
119 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
23 + *
24 + * @name everyLimit
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.every]{@link module:Collections.every}
29 + * @alias allLimit
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {number} limit - The maximum number of async operations at a time.
33 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34 + * in the collection in parallel.
35 + * The iteratee must complete with a boolean result value.
36 + * Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called after all the
38 + * `iteratee` functions have finished. Result will be either `true` or `false`
39 + * depending on the values of the async tests. Invoked with (err, result).
40 + * @returns {Promise} a promise, if no callback provided
41 + */
42 +function everyLimit(coll, limit, iteratee, callback) {
43 + return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
44 +}
45 +exports.default = (0, _awaitify2.default)(everyLimit, 4);
46 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfSeries = require('./eachOfSeries.js');
12 +
13 +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
23 + *
24 + * @name everySeries
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.every]{@link module:Collections.every}
29 + * @alias allSeries
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - An async truth test to apply to each item
33 + * in the collection in series.
34 + * The iteratee must complete with a boolean result value.
35 + * Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called after all the
37 + * `iteratee` functions have finished. Result will be either `true` or `false`
38 + * depending on the values of the async tests. Invoked with (err, result).
39 + * @returns {Promise} a promise, if no callback provided
40 + */
41 +function everySeries(coll, iteratee, callback) {
42 + return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback);
43 +}
44 +exports.default = (0, _awaitify2.default)(everySeries, 3);
45 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _filter2 = require('./internal/filter.js');
8 +
9 +var _filter3 = _interopRequireDefault(_filter2);
10 +
11 +var _eachOf = require('./eachOf.js');
12 +
13 +var _eachOf2 = _interopRequireDefault(_eachOf);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Returns a new array of all the values in `coll` which pass an async truth
23 + * test. This operation is performed in parallel, but the results array will be
24 + * in the same order as the original.
25 + *
26 + * @name filter
27 + * @static
28 + * @memberOf module:Collections
29 + * @method
30 + * @alias select
31 + * @category Collection
32 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 + * @param {Function} iteratee - A truth test to apply to each item in `coll`.
34 + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
35 + * with a boolean argument once it has completed. Invoked with (item, callback).
36 + * @param {Function} [callback] - A callback which is called after all the
37 + * `iteratee` functions have finished. Invoked with (err, results).
38 + * @returns {Promise} a promise, if no callback provided
39 + * @example
40 + *
41 + * // dir1 is a directory that contains file1.txt, file2.txt
42 + * // dir2 is a directory that contains file3.txt, file4.txt
43 + * // dir3 is a directory that contains file5.txt
44 + *
45 + * const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
46 + *
47 + * // asynchronous function that checks if a file exists
48 + * function fileExists(file, callback) {
49 + * fs.access(file, fs.constants.F_OK, (err) => {
50 + * callback(null, !err);
51 + * });
52 + * }
53 + *
54 + * // Using callbacks
55 + * async.filter(files, fileExists, function(err, results) {
56 + * if(err) {
57 + * console.log(err);
58 + * } else {
59 + * console.log(results);
60 + * // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
61 + * // results is now an array of the existing files
62 + * }
63 + * });
64 + *
65 + * // Using Promises
66 + * async.filter(files, fileExists)
67 + * .then(results => {
68 + * console.log(results);
69 + * // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
70 + * // results is now an array of the existing files
71 + * }).catch(err => {
72 + * console.log(err);
73 + * });
74 + *
75 + * // Using async/await
76 + * async () => {
77 + * try {
78 + * let results = await async.filter(files, fileExists);
79 + * console.log(results);
80 + * // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
81 + * // results is now an array of the existing files
82 + * }
83 + * catch (err) {
84 + * console.log(err);
85 + * }
86 + * }
87 + *
88 + */
89 +function filter(coll, iteratee, callback) {
90 + return (0, _filter3.default)(_eachOf2.default, coll, iteratee, callback);
91 +}
92 +exports.default = (0, _awaitify2.default)(filter, 3);
93 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _filter2 = require('./internal/filter.js');
8 +
9 +var _filter3 = _interopRequireDefault(_filter2);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a
23 + * time.
24 + *
25 + * @name filterLimit
26 + * @static
27 + * @memberOf module:Collections
28 + * @method
29 + * @see [async.filter]{@link module:Collections.filter}
30 + * @alias selectLimit
31 + * @category Collection
32 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 + * @param {number} limit - The maximum number of async operations at a time.
34 + * @param {Function} iteratee - A truth test to apply to each item in `coll`.
35 + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
36 + * with a boolean argument once it has completed. Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called after all the
38 + * `iteratee` functions have finished. Invoked with (err, results).
39 + * @returns {Promise} a promise, if no callback provided
40 + */
41 +function filterLimit(coll, limit, iteratee, callback) {
42 + return (0, _filter3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
43 +}
44 +exports.default = (0, _awaitify2.default)(filterLimit, 4);
45 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _filter2 = require('./internal/filter.js');
8 +
9 +var _filter3 = _interopRequireDefault(_filter2);
10 +
11 +var _eachOfSeries = require('./eachOfSeries.js');
12 +
13 +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
23 + *
24 + * @name filterSeries
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.filter]{@link module:Collections.filter}
29 + * @alias selectSeries
30 + * @category Collection
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {Function} iteratee - A truth test to apply to each item in `coll`.
33 + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
34 + * with a boolean argument once it has completed. Invoked with (item, callback).
35 + * @param {Function} [callback] - A callback which is called after all the
36 + * `iteratee` functions have finished. Invoked with (err, results)
37 + * @returns {Promise} a promise, if no callback provided
38 + */
39 +function filterSeries(coll, iteratee, callback) {
40 + return (0, _filter3.default)(_eachOfSeries2.default, coll, iteratee, callback);
41 +}
42 +exports.default = (0, _awaitify2.default)(filterSeries, 3);
43 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOf = require('./eachOf.js');
12 +
13 +var _eachOf2 = _interopRequireDefault(_eachOf);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * Returns the first value in `coll` that passes an async truth test. The
23 + * `iteratee` is applied in parallel, meaning the first iteratee to return
24 + * `true` will fire the detect `callback` with that result. That means the
25 + * result might not be the first item in the original `coll` (in terms of order)
26 + * that passes the test.
27 +
28 + * If order within the original `coll` is important, then look at
29 + * [`detectSeries`]{@link module:Collections.detectSeries}.
30 + *
31 + * @name detect
32 + * @static
33 + * @memberOf module:Collections
34 + * @method
35 + * @alias find
36 + * @category Collections
37 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
38 + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
39 + * The iteratee must complete with a boolean value as its result.
40 + * Invoked with (item, callback).
41 + * @param {Function} [callback] - A callback which is called as soon as any
42 + * iteratee returns `true`, or after all the `iteratee` functions have finished.
43 + * Result will be the first item in the array that passes the truth test
44 + * (iteratee) or the value `undefined` if none passed. Invoked with
45 + * (err, result).
46 + * @returns A Promise, if no callback is passed
47 + * @example
48 + *
49 + * // dir1 is a directory that contains file1.txt, file2.txt
50 + * // dir2 is a directory that contains file3.txt, file4.txt
51 + * // dir3 is a directory that contains file5.txt
52 + *
53 + * // asynchronous function that checks if a file exists
54 + * function fileExists(file, callback) {
55 + * fs.access(file, fs.constants.F_OK, (err) => {
56 + * callback(null, !err);
57 + * });
58 + * }
59 + *
60 + * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
61 + * function(err, result) {
62 + * console.log(result);
63 + * // dir1/file1.txt
64 + * // result now equals the first file in the list that exists
65 + * }
66 + *);
67 + *
68 + * // Using Promises
69 + * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
70 + * .then(result => {
71 + * console.log(result);
72 + * // dir1/file1.txt
73 + * // result now equals the first file in the list that exists
74 + * }).catch(err => {
75 + * console.log(err);
76 + * });
77 + *
78 + * // Using async/await
79 + * async () => {
80 + * try {
81 + * let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
82 + * console.log(result);
83 + * // dir1/file1.txt
84 + * // result now equals the file in the list that exists
85 + * }
86 + * catch (err) {
87 + * console.log(err);
88 + * }
89 + * }
90 + *
91 + */
92 +function detect(coll, iteratee, callback) {
93 + return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback);
94 +}
95 +exports.default = (0, _awaitify2.default)(detect, 3);
96 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
23 + * time.
24 + *
25 + * @name detectLimit
26 + * @static
27 + * @memberOf module:Collections
28 + * @method
29 + * @see [async.detect]{@link module:Collections.detect}
30 + * @alias findLimit
31 + * @category Collections
32 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 + * @param {number} limit - The maximum number of async operations at a time.
34 + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
35 + * The iteratee must complete with a boolean value as its result.
36 + * Invoked with (item, callback).
37 + * @param {Function} [callback] - A callback which is called as soon as any
38 + * iteratee returns `true`, or after all the `iteratee` functions have finished.
39 + * Result will be the first item in the array that passes the truth test
40 + * (iteratee) or the value `undefined` if none passed. Invoked with
41 + * (err, result).
42 + * @returns a Promise if no callback is passed
43 + */
44 +function detectLimit(coll, limit, iteratee, callback) {
45 + return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
46 +}
47 +exports.default = (0, _awaitify2.default)(detectLimit, 4);
48 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _createTester = require('./internal/createTester.js');
8 +
9 +var _createTester2 = _interopRequireDefault(_createTester);
10 +
11 +var _eachOfLimit = require('./internal/eachOfLimit.js');
12 +
13 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
23 + *
24 + * @name detectSeries
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.detect]{@link module:Collections.detect}
29 + * @alias findSeries
30 + * @category Collections
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
33 + * The iteratee must complete with a boolean value as its result.
34 + * Invoked with (item, callback).
35 + * @param {Function} [callback] - A callback which is called as soon as any
36 + * iteratee returns `true`, or after all the `iteratee` functions have finished.
37 + * Result will be the first item in the array that passes the truth test
38 + * (iteratee) or the value `undefined` if none passed. Invoked with
39 + * (err, result).
40 + * @returns a Promise if no callback is passed
41 + */
42 +function detectSeries(coll, iteratee, callback) {
43 + return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback);
44 +}
45 +
46 +exports.default = (0, _awaitify2.default)(detectSeries, 3);
47 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _concatLimit = require('./concatLimit.js');
8 +
9 +var _concatLimit2 = _interopRequireDefault(_concatLimit);
10 +
11 +var _awaitify = require('./internal/awaitify.js');
12 +
13 +var _awaitify2 = _interopRequireDefault(_awaitify);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * Applies `iteratee` to each item in `coll`, concatenating the results. Returns
19 + * the concatenated list. The `iteratee`s are called in parallel, and the
20 + * results are concatenated as they return. The results array will be returned in
21 + * the original order of `coll` passed to the `iteratee` function.
22 + *
23 + * @name concat
24 + * @static
25 + * @memberOf module:Collections
26 + * @method
27 + * @category Collection
28 + * @alias flatMap
29 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
30 + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
31 + * which should use an array as its result. Invoked with (item, callback).
32 + * @param {Function} [callback] - A callback which is called after all the
33 + * `iteratee` functions have finished, or an error occurs. Results is an array
34 + * containing the concatenated results of the `iteratee` function. Invoked with
35 + * (err, results).
36 + * @returns A Promise, if no callback is passed
37 + * @example
38 + *
39 + * // dir1 is a directory that contains file1.txt, file2.txt
40 + * // dir2 is a directory that contains file3.txt, file4.txt
41 + * // dir3 is a directory that contains file5.txt
42 + * // dir4 does not exist
43 + *
44 + * let directoryList = ['dir1','dir2','dir3'];
45 + * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
46 + *
47 + * // Using callbacks
48 + * async.concat(directoryList, fs.readdir, function(err, results) {
49 + * if (err) {
50 + * console.log(err);
51 + * } else {
52 + * console.log(results);
53 + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
54 + * }
55 + * });
56 + *
57 + * // Error Handling
58 + * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
59 + * if (err) {
60 + * console.log(err);
61 + * // [ Error: ENOENT: no such file or directory ]
62 + * // since dir4 does not exist
63 + * } else {
64 + * console.log(results);
65 + * }
66 + * });
67 + *
68 + * // Using Promises
69 + * async.concat(directoryList, fs.readdir)
70 + * .then(results => {
71 + * console.log(results);
72 + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
73 + * }).catch(err => {
74 + * console.log(err);
75 + * });
76 + *
77 + * // Error Handling
78 + * async.concat(withMissingDirectoryList, fs.readdir)
79 + * .then(results => {
80 + * console.log(results);
81 + * }).catch(err => {
82 + * console.log(err);
83 + * // [ Error: ENOENT: no such file or directory ]
84 + * // since dir4 does not exist
85 + * });
86 + *
87 + * // Using async/await
88 + * async () => {
89 + * try {
90 + * let results = await async.concat(directoryList, fs.readdir);
91 + * console.log(results);
92 + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
93 + * } catch (err) {
94 + * console.log(err);
95 + * }
96 + * }
97 + *
98 + * // Error Handling
99 + * async () => {
100 + * try {
101 + * let results = await async.concat(withMissingDirectoryList, fs.readdir);
102 + * console.log(results);
103 + * } catch (err) {
104 + * console.log(err);
105 + * // [ Error: ENOENT: no such file or directory ]
106 + * // since dir4 does not exist
107 + * }
108 + * }
109 + *
110 + */
111 +function concat(coll, iteratee, callback) {
112 + return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
113 +}
114 +exports.default = (0, _awaitify2.default)(concat, 3);
115 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _wrapAsync = require('./internal/wrapAsync.js');
8 +
9 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
10 +
11 +var _mapLimit = require('./mapLimit.js');
12 +
13 +var _mapLimit2 = _interopRequireDefault(_mapLimit);
14 +
15 +var _awaitify = require('./internal/awaitify.js');
16 +
17 +var _awaitify2 = _interopRequireDefault(_awaitify);
18 +
19 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 +
21 +/**
22 + * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
23 + *
24 + * @name concatLimit
25 + * @static
26 + * @memberOf module:Collections
27 + * @method
28 + * @see [async.concat]{@link module:Collections.concat}
29 + * @category Collection
30 + * @alias flatMapLimit
31 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 + * @param {number} limit - The maximum number of async operations at a time.
33 + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
34 + * which should use an array as its result. Invoked with (item, callback).
35 + * @param {Function} [callback] - A callback which is called after all the
36 + * `iteratee` functions have finished, or an error occurs. Results is an array
37 + * containing the concatenated results of the `iteratee` function. Invoked with
38 + * (err, results).
39 + * @returns A Promise, if no callback is passed
40 + */
41 +function concatLimit(coll, limit, iteratee, callback) {
42 + var _iteratee = (0, _wrapAsync2.default)(iteratee);
43 + return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
44 + _iteratee(val, (err, ...args) => {
45 + if (err) return iterCb(err);
46 + return iterCb(err, args);
47 + });
48 + }, (err, mapResults) => {
49 + var result = [];
50 + for (var i = 0; i < mapResults.length; i++) {
51 + if (mapResults[i]) {
52 + result = result.concat(...mapResults[i]);
53 + }
54 + }
55 +
56 + return callback(err, result);
57 + });
58 +}
59 +exports.default = (0, _awaitify2.default)(concatLimit, 4);
60 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _concatLimit = require('./concatLimit.js');
8 +
9 +var _concatLimit2 = _interopRequireDefault(_concatLimit);
10 +
11 +var _awaitify = require('./internal/awaitify.js');
12 +
13 +var _awaitify2 = _interopRequireDefault(_awaitify);
14 +
15 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16 +
17 +/**
18 + * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
19 + *
20 + * @name concatSeries
21 + * @static
22 + * @memberOf module:Collections
23 + * @method
24 + * @see [async.concat]{@link module:Collections.concat}
25 + * @category Collection
26 + * @alias flatMapSeries
27 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
28 + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
29 + * The iteratee should complete with an array an array of results.
30 + * Invoked with (item, callback).
31 + * @param {Function} [callback] - A callback which is called after all the
32 + * `iteratee` functions have finished, or an error occurs. Results is an array
33 + * containing the concatenated results of the `iteratee` function. Invoked with
34 + * (err, results).
35 + * @returns A Promise, if no callback is passed
36 + */
37 +function concatSeries(coll, iteratee, callback) {
38 + return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
39 +}
40 +exports.default = (0, _awaitify2.default)(concatSeries, 3);
41 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOfSeries = require('./eachOfSeries.js');
8 +
9 +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
10 +
11 +var _once = require('./internal/once.js');
12 +
13 +var _once2 = _interopRequireDefault(_once);
14 +
15 +var _wrapAsync = require('./internal/wrapAsync.js');
16 +
17 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18 +
19 +var _awaitify = require('./internal/awaitify.js');
20 +
21 +var _awaitify2 = _interopRequireDefault(_awaitify);
22 +
23 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 +
25 +/**
26 + * Reduces `coll` into a single value using an async `iteratee` to return each
27 + * successive step. `memo` is the initial state of the reduction. This function
28 + * only operates in series.
29 + *
30 + * For performance reasons, it may make sense to split a call to this function
31 + * into a parallel map, and then use the normal `Array.prototype.reduce` on the
32 + * results. This function is for situations where each step in the reduction
33 + * needs to be async; if you can get the data before reducing it, then it's
34 + * probably a good idea to do so.
35 + *
36 + * @name reduce
37 + * @static
38 + * @memberOf module:Collections
39 + * @method
40 + * @alias inject
41 + * @alias foldl
42 + * @category Collection
43 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
44 + * @param {*} memo - The initial state of the reduction.
45 + * @param {AsyncFunction} iteratee - A function applied to each item in the
46 + * array to produce the next step in the reduction.
47 + * The `iteratee` should complete with the next state of the reduction.
48 + * If the iteratee completes with an error, the reduction is stopped and the
49 + * main `callback` is immediately called with the error.
50 + * Invoked with (memo, item, callback).
51 + * @param {Function} [callback] - A callback which is called after all the
52 + * `iteratee` functions have finished. Result is the reduced value. Invoked with
53 + * (err, result).
54 + * @returns {Promise} a promise, if no callback is passed
55 + * @example
56 + *
57 + * // file1.txt is a file that is 1000 bytes in size
58 + * // file2.txt is a file that is 2000 bytes in size
59 + * // file3.txt is a file that is 3000 bytes in size
60 + * // file4.txt does not exist
61 + *
62 + * const fileList = ['file1.txt','file2.txt','file3.txt'];
63 + * const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
64 + *
65 + * // asynchronous function that computes the file size in bytes
66 + * // file size is added to the memoized value, then returned
67 + * function getFileSizeInBytes(memo, file, callback) {
68 + * fs.stat(file, function(err, stat) {
69 + * if (err) {
70 + * return callback(err);
71 + * }
72 + * callback(null, memo + stat.size);
73 + * });
74 + * }
75 + *
76 + * // Using callbacks
77 + * async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
78 + * if (err) {
79 + * console.log(err);
80 + * } else {
81 + * console.log(result);
82 + * // 6000
83 + * // which is the sum of the file sizes of the three files
84 + * }
85 + * });
86 + *
87 + * // Error Handling
88 + * async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
89 + * if (err) {
90 + * console.log(err);
91 + * // [ Error: ENOENT: no such file or directory ]
92 + * } else {
93 + * console.log(result);
94 + * }
95 + * });
96 + *
97 + * // Using Promises
98 + * async.reduce(fileList, 0, getFileSizeInBytes)
99 + * .then( result => {
100 + * console.log(result);
101 + * // 6000
102 + * // which is the sum of the file sizes of the three files
103 + * }).catch( err => {
104 + * console.log(err);
105 + * });
106 + *
107 + * // Error Handling
108 + * async.reduce(withMissingFileList, 0, getFileSizeInBytes)
109 + * .then( result => {
110 + * console.log(result);
111 + * }).catch( err => {
112 + * console.log(err);
113 + * // [ Error: ENOENT: no such file or directory ]
114 + * });
115 + *
116 + * // Using async/await
117 + * async () => {
118 + * try {
119 + * let result = await async.reduce(fileList, 0, getFileSizeInBytes);
120 + * console.log(result);
121 + * // 6000
122 + * // which is the sum of the file sizes of the three files
123 + * }
124 + * catch (err) {
125 + * console.log(err);
126 + * }
127 + * }
128 + *
129 + * // Error Handling
130 + * async () => {
131 + * try {
132 + * let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
133 + * console.log(result);
134 + * }
135 + * catch (err) {
136 + * console.log(err);
137 + * // [ Error: ENOENT: no such file or directory ]
138 + * }
139 + * }
140 + *
141 + */
142 +function reduce(coll, memo, iteratee, callback) {
143 + callback = (0, _once2.default)(callback);
144 + var _iteratee = (0, _wrapAsync2.default)(iteratee);
145 + return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => {
146 + _iteratee(memo, x, (err, v) => {
147 + memo = v;
148 + iterCb(err);
149 + });
150 + }, err => callback(err, memo));
151 +}
152 +exports.default = (0, _awaitify2.default)(reduce, 4);
153 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +exports.default = reduceRight;
7 +
8 +var _reduce = require('./reduce.js');
9 +
10 +var _reduce2 = _interopRequireDefault(_reduce);
11 +
12 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 +
14 +/**
15 + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
16 + *
17 + * @name reduceRight
18 + * @static
19 + * @memberOf module:Collections
20 + * @method
21 + * @see [async.reduce]{@link module:Collections.reduce}
22 + * @alias foldr
23 + * @category Collection
24 + * @param {Array} array - A collection to iterate over.
25 + * @param {*} memo - The initial state of the reduction.
26 + * @param {AsyncFunction} iteratee - A function applied to each item in the
27 + * array to produce the next step in the reduction.
28 + * The `iteratee` should complete with the next state of the reduction.
29 + * If the iteratee completes with an error, the reduction is stopped and the
30 + * main `callback` is immediately called with the error.
31 + * Invoked with (memo, item, callback).
32 + * @param {Function} [callback] - A callback which is called after all the
33 + * `iteratee` functions have finished. Result is the reduced value. Invoked with
34 + * (err, result).
35 + * @returns {Promise} a promise, if no callback is passed
36 + */
37 +function reduceRight(array, memo, iteratee, callback) {
38 + var reversed = [...array].reverse();
39 + return (0, _reduce2.default)(reversed, memo, iteratee, callback);
40 +}
41 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOf = require('./eachOf.js');
8 +
9 +var _eachOf2 = _interopRequireDefault(_eachOf);
10 +
11 +var _withoutIndex = require('./internal/withoutIndex.js');
12 +
13 +var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
14 +
15 +var _wrapAsync = require('./internal/wrapAsync.js');
16 +
17 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18 +
19 +var _awaitify = require('./internal/awaitify.js');
20 +
21 +var _awaitify2 = _interopRequireDefault(_awaitify);
22 +
23 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 +
25 +/**
26 + * Applies the function `iteratee` to each item in `coll`, in parallel.
27 + * The `iteratee` is called with an item from the list, and a callback for when
28 + * it has finished. If the `iteratee` passes an error to its `callback`, the
29 + * main `callback` (for the `each` function) is immediately called with the
30 + * error.
31 + *
32 + * Note, that since this function applies `iteratee` to each item in parallel,
33 + * there is no guarantee that the iteratee functions will complete in order.
34 + *
35 + * @name each
36 + * @static
37 + * @memberOf module:Collections
38 + * @method
39 + * @alias forEach
40 + * @category Collection
41 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
42 + * @param {AsyncFunction} iteratee - An async function to apply to
43 + * each item in `coll`. Invoked with (item, callback).
44 + * The array index is not passed to the iteratee.
45 + * If you need the index, use `eachOf`.
46 + * @param {Function} [callback] - A callback which is called when all
47 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
48 + * @returns {Promise} a promise, if a callback is omitted
49 + * @example
50 + *
51 + * // dir1 is a directory that contains file1.txt, file2.txt
52 + * // dir2 is a directory that contains file3.txt, file4.txt
53 + * // dir3 is a directory that contains file5.txt
54 + * // dir4 does not exist
55 + *
56 + * const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
57 + * const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
58 + *
59 + * // asynchronous function that deletes a file
60 + * const deleteFile = function(file, callback) {
61 + * fs.unlink(file, callback);
62 + * };
63 + *
64 + * // Using callbacks
65 + * async.each(fileList, deleteFile, function(err) {
66 + * if( err ) {
67 + * console.log(err);
68 + * } else {
69 + * console.log('All files have been deleted successfully');
70 + * }
71 + * });
72 + *
73 + * // Error Handling
74 + * async.each(withMissingFileList, deleteFile, function(err){
75 + * console.log(err);
76 + * // [ Error: ENOENT: no such file or directory ]
77 + * // since dir4/file2.txt does not exist
78 + * // dir1/file1.txt could have been deleted
79 + * });
80 + *
81 + * // Using Promises
82 + * async.each(fileList, deleteFile)
83 + * .then( () => {
84 + * console.log('All files have been deleted successfully');
85 + * }).catch( err => {
86 + * console.log(err);
87 + * });
88 + *
89 + * // Error Handling
90 + * async.each(fileList, deleteFile)
91 + * .then( () => {
92 + * console.log('All files have been deleted successfully');
93 + * }).catch( err => {
94 + * console.log(err);
95 + * // [ Error: ENOENT: no such file or directory ]
96 + * // since dir4/file2.txt does not exist
97 + * // dir1/file1.txt could have been deleted
98 + * });
99 + *
100 + * // Using async/await
101 + * async () => {
102 + * try {
103 + * await async.each(files, deleteFile);
104 + * }
105 + * catch (err) {
106 + * console.log(err);
107 + * }
108 + * }
109 + *
110 + * // Error Handling
111 + * async () => {
112 + * try {
113 + * await async.each(withMissingFileList, deleteFile);
114 + * }
115 + * catch (err) {
116 + * console.log(err);
117 + * // [ Error: ENOENT: no such file or directory ]
118 + * // since dir4/file2.txt does not exist
119 + * // dir1/file1.txt could have been deleted
120 + * }
121 + * }
122 + *
123 + */
124 +function eachLimit(coll, iteratee, callback) {
125 + return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
126 +}
127 +
128 +exports.default = (0, _awaitify2.default)(eachLimit, 3);
129 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _eachOfLimit = require('./internal/eachOfLimit.js');
8 +
9 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
10 +
11 +var _withoutIndex = require('./internal/withoutIndex.js');
12 +
13 +var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
14 +
15 +var _wrapAsync = require('./internal/wrapAsync.js');
16 +
17 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18 +
19 +var _awaitify = require('./internal/awaitify.js');
20 +
21 +var _awaitify2 = _interopRequireDefault(_awaitify);
22 +
23 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 +
25 +/**
26 + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
27 + *
28 + * @name eachLimit
29 + * @static
30 + * @memberOf module:Collections
31 + * @method
32 + * @see [async.each]{@link module:Collections.each}
33 + * @alias forEachLimit
34 + * @category Collection
35 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
36 + * @param {number} limit - The maximum number of async operations at a time.
37 + * @param {AsyncFunction} iteratee - An async function to apply to each item in
38 + * `coll`.
39 + * The array index is not passed to the iteratee.
40 + * If you need the index, use `eachOfLimit`.
41 + * Invoked with (item, callback).
42 + * @param {Function} [callback] - A callback which is called when all
43 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
44 + * @returns {Promise} a promise, if a callback is omitted
45 + */
46 +function eachLimit(coll, limit, iteratee, callback) {
47 + return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
48 +}
49 +exports.default = (0, _awaitify2.default)(eachLimit, 4);
50 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +Object.defineProperty(exports, "__esModule", {
4 + value: true
5 +});
6 +
7 +var _isArrayLike = require('./internal/isArrayLike.js');
8 +
9 +var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
10 +
11 +var _breakLoop = require('./internal/breakLoop.js');
12 +
13 +var _breakLoop2 = _interopRequireDefault(_breakLoop);
14 +
15 +var _eachOfLimit = require('./eachOfLimit.js');
16 +
17 +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
18 +
19 +var _once = require('./internal/once.js');
20 +
21 +var _once2 = _interopRequireDefault(_once);
22 +
23 +var _onlyOnce = require('./internal/onlyOnce.js');
24 +
25 +var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
26 +
27 +var _wrapAsync = require('./internal/wrapAsync.js');
28 +
29 +var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
30 +
31 +var _awaitify = require('./internal/awaitify.js');
32 +
33 +var _awaitify2 = _interopRequireDefault(_awaitify);
34 +
35 +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36 +
37 +// eachOf implementation optimized for array-likes
38 +function eachOfArrayLike(coll, iteratee, callback) {
39 + callback = (0, _once2.default)(callback);
40 + var index = 0,
41 + completed = 0,
42 + { length } = coll,
43 + canceled = false;
44 + if (length === 0) {
45 + callback(null);
46 + }
47 +
48 + function iteratorCallback(err, value) {
49 + if (err === false) {
50 + canceled = true;
51 + }
52 + if (canceled === true) return;
53 + if (err) {
54 + callback(err);
55 + } else if (++completed === length || value === _breakLoop2.default) {
56 + callback(null);
57 + }
58 + }
59 +
60 + for (; index < length; index++) {
61 + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback));
62 + }
63 +}
64 +
65 +// a generic version of eachOf which can handle array, object, and iterator cases.
66 +function eachOfGeneric(coll, iteratee, callback) {
67 + return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback);
68 +}
69 +
70 +/**
71 + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
72 + * to the iteratee.
73 + *
74 + * @name eachOf
75 + * @static
76 + * @memberOf module:Collections
77 + * @method
78 + * @alias forEachOf
79 + * @category Collection
80 + * @see [async.each]{@link module:Collections.each}
81 + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
82 + * @param {AsyncFunction} iteratee - A function to apply to each
83 + * item in `coll`.
84 + * The `key` is the item's key, or index in the case of an array.
85 + * Invoked with (item, key, callback).
86 + * @param {Function} [callback] - A callback which is called when all
87 + * `iteratee` functions have finished, or an error occurs. Invoked with (err).
88 + * @returns {Promise} a promise, if a callback is omitted
89 + * @example
90 + *
91 + * // dev.json is a file containing a valid json object config for dev environment
92 + * // dev.json is a file containing a valid json object config for test environment
93 + * // prod.json is a file containing a valid json object config for prod environment
94 + * // invalid.json is a file with a malformed json object
95 + *
96 + * let configs = {}; //global variable
97 + * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
98 + * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
99 + *
100 + * // asynchronous function that reads a json file and parses the contents as json object
101 + * function parseFile(file, key, callback) {
102 + * fs.readFile(file, "utf8", function(err, data) {
103 + * if (err) return calback(err);
104 + * try {
105 + * configs[key] = JSON.parse(data);
106 + * } catch (e) {
107 + * return callback(e);
108 + * }
109 + * callback();
110 + * });
111 + * }
112 + *
113 + * // Using callbacks
114 + * async.forEachOf(validConfigFileMap, parseFile, function (err) {
115 + * if (err) {
116 + * console.error(err);
117 + * } else {
118 + * console.log(configs);
119 + * // configs is now a map of JSON data, e.g.
120 + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
121 + * }
122 + * });
123 + *
124 + * //Error handing
125 + * async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
126 + * if (err) {
127 + * console.error(err);
128 + * // JSON parse error exception
129 + * } else {
130 + * console.log(configs);
131 + * }
132 + * });
133 + *
134 + * // Using Promises
135 + * async.forEachOf(validConfigFileMap, parseFile)
136 + * .then( () => {
137 + * console.log(configs);
138 + * // configs is now a map of JSON data, e.g.
139 + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
140 + * }).catch( err => {
141 + * console.error(err);
142 + * });
143 + *
144 + * //Error handing
145 + * async.forEachOf(invalidConfigFileMap, parseFile)
146 + * .then( () => {
147 + * console.log(configs);
148 + * }).catch( err => {
149 + * console.error(err);
150 + * // JSON parse error exception
151 + * });
152 + *
153 + * // Using async/await
154 + * async () => {
155 + * try {
156 + * let result = await async.forEachOf(validConfigFileMap, parseFile);
157 + * console.log(configs);
158 + * // configs is now a map of JSON data, e.g.
159 + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
160 + * }
161 + * catch (err) {
162 + * console.log(err);
163 + * }
164 + * }
165 + *
166 + * //Error handing
167 + * async () => {
168 + * try {
169 + * let result = await async.forEachOf(invalidConfigFileMap, parseFile);
170 + * console.log(configs);
171 + * }
172 + * catch (err) {
173 + * console.log(err);
174 + * // JSON parse error exception
175 + * }
176 + * }
177 + *
178 + */
179 +function eachOf(coll, iteratee, callback) {
180 + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric;
181 + return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback);
182 +}
183 +
184 +exports.default = (0, _awaitify2.default)(eachOf, 3);
185 +module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.