@contrast/agent 4.16.1 → 4.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/VERSION +1 -1
- package/bin/linux/contrast-service +0 -0
- package/bin/mac/contrast-service +0 -0
- package/bin/windows/contrast-service.exe +0 -0
- package/lib/protect/rules/cmd-injection/cmdinjection-rule.js +1 -1
- package/node_modules/async/CHANGELOG.md +13 -0
- package/node_modules/async/all.js +74 -9
- package/node_modules/async/allLimit.js +3 -3
- package/node_modules/async/allSeries.js +3 -3
- package/node_modules/async/any.js +75 -9
- package/node_modules/async/anyLimit.js +3 -3
- package/node_modules/async/anySeries.js +3 -3
- package/node_modules/async/applyEach.js +2 -2
- package/node_modules/async/applyEachSeries.js +2 -2
- package/node_modules/async/asyncify.js +3 -3
- package/node_modules/async/auto.js +81 -15
- package/node_modules/async/autoInject.js +30 -4
- package/node_modules/async/cargo.js +1 -1
- package/node_modules/async/cargoQueue.js +1 -1
- package/node_modules/async/compose.js +1 -1
- package/node_modules/async/concat.js +72 -4
- package/node_modules/async/concatLimit.js +3 -3
- package/node_modules/async/concatSeries.js +2 -2
- package/node_modules/async/detect.js +43 -8
- package/node_modules/async/detectLimit.js +3 -3
- package/node_modules/async/detectSeries.js +3 -3
- package/node_modules/async/dir.js +1 -1
- package/node_modules/async/dist/async.js +1379 -168
- package/node_modules/async/dist/async.min.js +1 -1
- package/node_modules/async/dist/async.mjs +1372 -161
- package/node_modules/async/doDuring.js +3 -3
- package/node_modules/async/doUntil.js +2 -2
- package/node_modules/async/doWhilst.js +3 -3
- package/node_modules/async/during.js +3 -3
- package/node_modules/async/each.js +69 -28
- package/node_modules/async/eachLimit.js +4 -4
- package/node_modules/async/eachOf.js +85 -16
- package/node_modules/async/eachOfLimit.js +3 -3
- package/node_modules/async/eachOfSeries.js +2 -2
- package/node_modules/async/eachSeries.js +2 -2
- package/node_modules/async/ensureAsync.js +2 -2
- package/node_modules/async/every.js +74 -9
- package/node_modules/async/everyLimit.js +3 -3
- package/node_modules/async/everySeries.js +3 -3
- package/node_modules/async/filter.js +49 -9
- package/node_modules/async/filterLimit.js +3 -3
- package/node_modules/async/filterSeries.js +3 -3
- package/node_modules/async/find.js +43 -8
- package/node_modules/async/findLimit.js +3 -3
- package/node_modules/async/findSeries.js +3 -3
- package/node_modules/async/flatMap.js +72 -4
- package/node_modules/async/flatMapLimit.js +3 -3
- package/node_modules/async/flatMapSeries.js +2 -2
- package/node_modules/async/foldl.js +87 -11
- package/node_modules/async/foldr.js +2 -2
- package/node_modules/async/forEach.js +69 -28
- package/node_modules/async/forEachLimit.js +4 -4
- package/node_modules/async/forEachOf.js +85 -16
- package/node_modules/async/forEachOfLimit.js +3 -3
- package/node_modules/async/forEachOfSeries.js +2 -2
- package/node_modules/async/forEachSeries.js +2 -2
- package/node_modules/async/forever.js +4 -4
- package/node_modules/async/groupBy.js +62 -8
- package/node_modules/async/groupByLimit.js +3 -3
- package/node_modules/async/groupBySeries.js +2 -2
- package/node_modules/async/inject.js +87 -11
- package/node_modules/async/internal/applyEach.js +2 -2
- package/node_modules/async/internal/asyncEachOfLimit.js +1 -1
- package/node_modules/async/internal/consoleFunc.js +5 -1
- package/node_modules/async/internal/createTester.js +2 -2
- package/node_modules/async/internal/eachOfLimit.js +6 -6
- package/node_modules/async/internal/filter.js +2 -2
- package/node_modules/async/internal/iterator.js +5 -2
- package/node_modules/async/internal/map.js +1 -1
- package/node_modules/async/internal/parallel.js +3 -3
- package/node_modules/async/internal/queue.js +4 -4
- package/node_modules/async/internal/reject.js +2 -2
- package/node_modules/async/internal/setImmediate.js +6 -2
- package/node_modules/async/internal/wrapAsync.js +1 -1
- package/node_modules/async/log.js +1 -1
- package/node_modules/async/map.js +86 -6
- package/node_modules/async/mapLimit.js +3 -3
- package/node_modules/async/mapSeries.js +3 -3
- package/node_modules/async/mapValues.js +102 -12
- package/node_modules/async/mapValuesLimit.js +4 -4
- package/node_modules/async/mapValuesSeries.js +1 -1
- package/node_modules/async/memoize.js +3 -3
- package/node_modules/async/nextTick.js +3 -3
- package/node_modules/async/package.json +4 -6
- package/node_modules/async/parallel.js +96 -7
- package/node_modules/async/parallelLimit.js +2 -2
- package/node_modules/async/priorityQueue.js +11 -4
- package/node_modules/async/queue.js +4 -4
- package/node_modules/async/race.js +3 -3
- package/node_modules/async/reduce.js +87 -11
- package/node_modules/async/reduceRight.js +2 -2
- package/node_modules/async/reflect.js +2 -2
- package/node_modules/async/reflectAll.js +1 -1
- package/node_modules/async/reject.js +44 -10
- package/node_modules/async/rejectLimit.js +3 -3
- package/node_modules/async/rejectSeries.js +3 -3
- package/node_modules/async/retry.js +2 -2
- package/node_modules/async/retryable.js +4 -4
- package/node_modules/async/select.js +49 -9
- package/node_modules/async/selectLimit.js +3 -3
- package/node_modules/async/selectSeries.js +3 -3
- package/node_modules/async/seq.js +4 -4
- package/node_modules/async/series.js +112 -12
- package/node_modules/async/setImmediate.js +1 -1
- package/node_modules/async/some.js +75 -9
- package/node_modules/async/someLimit.js +3 -3
- package/node_modules/async/someSeries.js +3 -3
- package/node_modules/async/sortBy.js +121 -19
- package/node_modules/async/timeout.js +2 -2
- package/node_modules/async/times.js +1 -1
- package/node_modules/async/timesLimit.js +3 -3
- package/node_modules/async/timesSeries.js +1 -1
- package/node_modules/async/transform.js +111 -19
- package/node_modules/async/tryEach.js +3 -3
- package/node_modules/async/until.js +3 -3
- package/node_modules/async/waterfall.js +4 -4
- package/node_modules/async/whilst.js +3 -3
- package/node_modules/async/wrapSync.js +3 -3
- package/package.json +1 -1
package/bin/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.28.
|
|
1
|
+
2.28.20
|
|
Binary file
|
package/bin/mac/contrast-service
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# v3.2.3
|
|
2
|
+
- Fix bugs in comment parsing in `autoInject`. (#1767, #1780)
|
|
3
|
+
|
|
4
|
+
# v3.2.2
|
|
5
|
+
- Fix potential prototype pollution exploit
|
|
6
|
+
|
|
7
|
+
# v3.2.1
|
|
8
|
+
- Use `queueMicrotask` if available to the environment (#1761)
|
|
9
|
+
- Minor perf improvement in `priorityQueue` (#1727)
|
|
10
|
+
- More examples in documentation (#1726)
|
|
11
|
+
- Various doc fixes (#1708, #1712, #1717, #1740, #1739, #1749, #1756)
|
|
12
|
+
- Improved test coverage (#1754)
|
|
13
|
+
|
|
1
14
|
# v3.2.0
|
|
2
15
|
- Fix a bug in Safari related to overwriting `func.name`
|
|
3
16
|
- Remove built-in browserify configuration (#1653)
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _createTester = require('./internal/createTester');
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
8
|
|
|
9
9
|
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
10
|
|
|
11
|
-
var _eachOf = require('./eachOf');
|
|
11
|
+
var _eachOf = require('./eachOf.js');
|
|
12
12
|
|
|
13
13
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
|
14
14
|
|
|
15
|
-
var _awaitify = require('./internal/awaitify');
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
16
|
|
|
17
17
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
18
|
|
|
@@ -39,13 +39,78 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
39
39
|
* @returns {Promise} a promise, if no callback provided
|
|
40
40
|
* @example
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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);
|
|
48
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
|
+
*
|
|
49
114
|
*/
|
|
50
115
|
function every(coll, iteratee, callback) {
|
|
51
116
|
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _createTester = require('./internal/createTester');
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
8
|
|
|
9
9
|
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
10
|
|
|
11
|
-
var _eachOfLimit = require('./internal/eachOfLimit');
|
|
11
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
12
12
|
|
|
13
13
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
14
14
|
|
|
15
|
-
var _awaitify = require('./internal/awaitify');
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
16
|
|
|
17
17
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
18
|
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _createTester = require('./internal/createTester');
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
8
|
|
|
9
9
|
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
10
|
|
|
11
|
-
var _eachOfSeries = require('./eachOfSeries');
|
|
11
|
+
var _eachOfSeries = require('./eachOfSeries.js');
|
|
12
12
|
|
|
13
13
|
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|
14
14
|
|
|
15
|
-
var _awaitify = require('./internal/awaitify');
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
16
|
|
|
17
17
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
18
|
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _createTester = require('./internal/createTester');
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
8
|
|
|
9
9
|
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
10
|
|
|
11
|
-
var _eachOf = require('./eachOf');
|
|
11
|
+
var _eachOf = require('./eachOf.js');
|
|
12
12
|
|
|
13
13
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
|
14
14
|
|
|
15
|
-
var _awaitify = require('./internal/awaitify');
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
16
|
|
|
17
17
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
18
|
|
|
@@ -41,13 +41,79 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
41
41
|
* @returns {Promise} a promise, if no callback provided
|
|
42
42
|
* @example
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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);
|
|
50
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
|
+
*
|
|
51
117
|
*/
|
|
52
118
|
function some(coll, iteratee, callback) {
|
|
53
119
|
return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _createTester = require('./internal/createTester');
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
8
|
|
|
9
9
|
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
10
|
|
|
11
|
-
var _eachOfLimit = require('./internal/eachOfLimit');
|
|
11
|
+
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
|
12
12
|
|
|
13
13
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
|
14
14
|
|
|
15
|
-
var _awaitify = require('./internal/awaitify');
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
16
|
|
|
17
17
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
18
|
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _createTester = require('./internal/createTester');
|
|
7
|
+
var _createTester = require('./internal/createTester.js');
|
|
8
8
|
|
|
9
9
|
var _createTester2 = _interopRequireDefault(_createTester);
|
|
10
10
|
|
|
11
|
-
var _eachOfSeries = require('./eachOfSeries');
|
|
11
|
+
var _eachOfSeries = require('./eachOfSeries.js');
|
|
12
12
|
|
|
13
13
|
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
|
14
14
|
|
|
15
|
-
var _awaitify = require('./internal/awaitify');
|
|
15
|
+
var _awaitify = require('./internal/awaitify.js');
|
|
16
16
|
|
|
17
17
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
|
18
18
|
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _applyEach = require('./internal/applyEach');
|
|
7
|
+
var _applyEach = require('./internal/applyEach.js');
|
|
8
8
|
|
|
9
9
|
var _applyEach2 = _interopRequireDefault(_applyEach);
|
|
10
10
|
|
|
11
|
-
var _map = require('./map');
|
|
11
|
+
var _map = require('./map.js');
|
|
12
12
|
|
|
13
13
|
var _map2 = _interopRequireDefault(_map);
|
|
14
14
|
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _applyEach = require('./internal/applyEach');
|
|
7
|
+
var _applyEach = require('./internal/applyEach.js');
|
|
8
8
|
|
|
9
9
|
var _applyEach2 = _interopRequireDefault(_applyEach);
|
|
10
10
|
|
|
11
|
-
var _mapSeries = require('./mapSeries');
|
|
11
|
+
var _mapSeries = require('./mapSeries.js');
|
|
12
12
|
|
|
13
13
|
var _mapSeries2 = _interopRequireDefault(_mapSeries);
|
|
14
14
|
|
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = asyncify;
|
|
7
7
|
|
|
8
|
-
var _initialParams = require('./internal/initialParams');
|
|
8
|
+
var _initialParams = require('./internal/initialParams.js');
|
|
9
9
|
|
|
10
10
|
var _initialParams2 = _interopRequireDefault(_initialParams);
|
|
11
11
|
|
|
12
|
-
var _setImmediate = require('./internal/setImmediate');
|
|
12
|
+
var _setImmediate = require('./internal/setImmediate.js');
|
|
13
13
|
|
|
14
14
|
var _setImmediate2 = _interopRequireDefault(_setImmediate);
|
|
15
15
|
|
|
16
|
-
var _wrapAsync = require('./internal/wrapAsync');
|
|
16
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
@@ -5,19 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = auto;
|
|
7
7
|
|
|
8
|
-
var _once = require('./internal/once');
|
|
8
|
+
var _once = require('./internal/once.js');
|
|
9
9
|
|
|
10
10
|
var _once2 = _interopRequireDefault(_once);
|
|
11
11
|
|
|
12
|
-
var _onlyOnce = require('./internal/onlyOnce');
|
|
12
|
+
var _onlyOnce = require('./internal/onlyOnce.js');
|
|
13
13
|
|
|
14
14
|
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
|
15
15
|
|
|
16
|
-
var _wrapAsync = require('./internal/wrapAsync');
|
|
16
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
17
17
|
|
|
18
18
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
19
19
|
|
|
20
|
-
var _promiseCallback = require('./internal/promiseCallback');
|
|
20
|
+
var _promiseCallback = require('./internal/promiseCallback.js');
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
@@ -62,15 +62,40 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
62
62
|
* @returns {Promise} a promise, if a callback is not passed
|
|
63
63
|
* @example
|
|
64
64
|
*
|
|
65
|
+
* //Using Callbacks
|
|
65
66
|
* async.auto({
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
67
|
+
* get_data: function(callback) {
|
|
68
|
+
* // async code to get some data
|
|
69
|
+
* callback(null, 'data', 'converted to array');
|
|
70
|
+
* },
|
|
71
|
+
* make_folder: function(callback) {
|
|
72
|
+
* // async code to create a directory to store a file in
|
|
73
|
+
* // this is run at the same time as getting the data
|
|
74
|
+
* callback(null, 'folder');
|
|
75
|
+
* },
|
|
76
|
+
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
77
|
+
* // once there is some data and the directory exists,
|
|
78
|
+
* // write the data to a file in the directory
|
|
79
|
+
* callback(null, 'filename');
|
|
80
|
+
* }],
|
|
81
|
+
* email_link: ['write_file', function(results, callback) {
|
|
82
|
+
* // once the file is written let's email a link to it...
|
|
83
|
+
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
71
84
|
* }]
|
|
72
|
-
* },
|
|
85
|
+
* }, function(err, results) {
|
|
86
|
+
* if (err) {
|
|
87
|
+
* console.log('err = ', err);
|
|
88
|
+
* }
|
|
89
|
+
* console.log('results = ', results);
|
|
90
|
+
* // results = {
|
|
91
|
+
* // get_data: ['data', 'converted to array']
|
|
92
|
+
* // make_folder; 'folder',
|
|
93
|
+
* // write_file: 'filename'
|
|
94
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
95
|
+
* // }
|
|
96
|
+
* });
|
|
73
97
|
*
|
|
98
|
+
* //Using Promises
|
|
74
99
|
* async.auto({
|
|
75
100
|
* get_data: function(callback) {
|
|
76
101
|
* console.log('in get_data');
|
|
@@ -84,21 +109,62 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
84
109
|
* callback(null, 'folder');
|
|
85
110
|
* },
|
|
86
111
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
87
|
-
* console.log('in write_file', JSON.stringify(results));
|
|
88
112
|
* // once there is some data and the directory exists,
|
|
89
113
|
* // write the data to a file in the directory
|
|
90
114
|
* callback(null, 'filename');
|
|
91
115
|
* }],
|
|
92
116
|
* email_link: ['write_file', function(results, callback) {
|
|
93
|
-
* console.log('in email_link', JSON.stringify(results));
|
|
94
117
|
* // once the file is written let's email a link to it...
|
|
95
|
-
* // results.write_file contains the filename returned by write_file.
|
|
96
118
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
97
119
|
* }]
|
|
98
|
-
* }
|
|
99
|
-
* console.log('err = ', err);
|
|
120
|
+
* }).then(results => {
|
|
100
121
|
* console.log('results = ', results);
|
|
122
|
+
* // results = {
|
|
123
|
+
* // get_data: ['data', 'converted to array']
|
|
124
|
+
* // make_folder; 'folder',
|
|
125
|
+
* // write_file: 'filename'
|
|
126
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
127
|
+
* // }
|
|
128
|
+
* }).catch(err => {
|
|
129
|
+
* console.log('err = ', err);
|
|
101
130
|
* });
|
|
131
|
+
*
|
|
132
|
+
* //Using async/await
|
|
133
|
+
* async () => {
|
|
134
|
+
* try {
|
|
135
|
+
* let results = await async.auto({
|
|
136
|
+
* get_data: function(callback) {
|
|
137
|
+
* // async code to get some data
|
|
138
|
+
* callback(null, 'data', 'converted to array');
|
|
139
|
+
* },
|
|
140
|
+
* make_folder: function(callback) {
|
|
141
|
+
* // async code to create a directory to store a file in
|
|
142
|
+
* // this is run at the same time as getting the data
|
|
143
|
+
* callback(null, 'folder');
|
|
144
|
+
* },
|
|
145
|
+
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
146
|
+
* // once there is some data and the directory exists,
|
|
147
|
+
* // write the data to a file in the directory
|
|
148
|
+
* callback(null, 'filename');
|
|
149
|
+
* }],
|
|
150
|
+
* email_link: ['write_file', function(results, callback) {
|
|
151
|
+
* // once the file is written let's email a link to it...
|
|
152
|
+
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
153
|
+
* }]
|
|
154
|
+
* });
|
|
155
|
+
* console.log('results = ', results);
|
|
156
|
+
* // results = {
|
|
157
|
+
* // get_data: ['data', 'converted to array']
|
|
158
|
+
* // make_folder; 'folder',
|
|
159
|
+
* // write_file: 'filename'
|
|
160
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
161
|
+
* // }
|
|
162
|
+
* }
|
|
163
|
+
* catch (err) {
|
|
164
|
+
* console.log(err);
|
|
165
|
+
* }
|
|
166
|
+
* }
|
|
167
|
+
*
|
|
102
168
|
*/
|
|
103
169
|
function auto(tasks, concurrency, callback) {
|
|
104
170
|
if (typeof concurrency !== 'number') {
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = autoInject;
|
|
7
7
|
|
|
8
|
-
var _auto = require('./auto');
|
|
8
|
+
var _auto = require('./auto.js');
|
|
9
9
|
|
|
10
10
|
var _auto2 = _interopRequireDefault(_auto);
|
|
11
11
|
|
|
12
|
-
var _wrapAsync = require('./internal/wrapAsync');
|
|
12
|
+
var _wrapAsync = require('./internal/wrapAsync.js');
|
|
13
13
|
|
|
14
14
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
|
15
15
|
|
|
@@ -19,10 +19,36 @@ var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
|
|
|
19
19
|
var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
|
|
20
20
|
var FN_ARG_SPLIT = /,/;
|
|
21
21
|
var FN_ARG = /(=.+)?(\s*)$/;
|
|
22
|
-
|
|
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
|
+
}
|
|
23
49
|
|
|
24
50
|
function parseParams(func) {
|
|
25
|
-
const src = func.toString()
|
|
51
|
+
const src = stripComments(func.toString());
|
|
26
52
|
let match = src.match(FN_ARGS);
|
|
27
53
|
if (!match) {
|
|
28
54
|
match = src.match(ARROW_FN_ARGS);
|