@ikas/storefront 0.1.7 → 0.1.9
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/build/index.es.js +1358 -162
- package/build/index.js +1358 -162
- package/package.json +3 -5
package/build/index.js
CHANGED
|
@@ -73621,6 +73621,7 @@ function initialParams (fn) {
|
|
|
73621
73621
|
|
|
73622
73622
|
/* istanbul ignore file */
|
|
73623
73623
|
|
|
73624
|
+
var hasQueueMicrotask = typeof queueMicrotask === 'function' && queueMicrotask;
|
|
73624
73625
|
var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
|
|
73625
73626
|
var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
|
|
73626
73627
|
|
|
@@ -73634,7 +73635,9 @@ function wrap$2(defer) {
|
|
|
73634
73635
|
|
|
73635
73636
|
var _defer;
|
|
73636
73637
|
|
|
73637
|
-
if (
|
|
73638
|
+
if (hasQueueMicrotask) {
|
|
73639
|
+
_defer = queueMicrotask;
|
|
73640
|
+
} else if (hasSetImmediate) {
|
|
73638
73641
|
_defer = setImmediate;
|
|
73639
73642
|
} else if (hasNextTick) {
|
|
73640
73643
|
_defer = process.nextTick;
|
|
@@ -74086,12 +74089,19 @@ function eachOfGeneric (coll, iteratee, callback) {
|
|
|
74086
74089
|
* @returns {Promise} a promise, if a callback is omitted
|
|
74087
74090
|
* @example
|
|
74088
74091
|
*
|
|
74089
|
-
*
|
|
74090
|
-
*
|
|
74092
|
+
* // dev.json is a file containing a valid json object config for dev environment
|
|
74093
|
+
* // dev.json is a file containing a valid json object config for test environment
|
|
74094
|
+
* // prod.json is a file containing a valid json object config for prod environment
|
|
74095
|
+
* // invalid.json is a file with a malformed json object
|
|
74091
74096
|
*
|
|
74092
|
-
*
|
|
74093
|
-
*
|
|
74094
|
-
*
|
|
74097
|
+
* let configs = {}; //global variable
|
|
74098
|
+
* let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
|
|
74099
|
+
* let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
|
|
74100
|
+
*
|
|
74101
|
+
* // asynchronous function that reads a json file and parses the contents as json object
|
|
74102
|
+
* function parseFile(file, key, callback) {
|
|
74103
|
+
* fs.readFile(file, "utf8", function(err, data) {
|
|
74104
|
+
* if (err) return calback(err);
|
|
74095
74105
|
* try {
|
|
74096
74106
|
* configs[key] = JSON.parse(data);
|
|
74097
74107
|
* } catch (e) {
|
|
@@ -74099,11 +74109,73 @@ function eachOfGeneric (coll, iteratee, callback) {
|
|
|
74099
74109
|
* }
|
|
74100
74110
|
* callback();
|
|
74101
74111
|
* });
|
|
74102
|
-
* }
|
|
74103
|
-
*
|
|
74104
|
-
*
|
|
74105
|
-
*
|
|
74112
|
+
* }
|
|
74113
|
+
*
|
|
74114
|
+
* // Using callbacks
|
|
74115
|
+
* async.forEachOf(validConfigFileMap, parseFile, function (err) {
|
|
74116
|
+
* if (err) {
|
|
74117
|
+
* console.error(err);
|
|
74118
|
+
* } else {
|
|
74119
|
+
* console.log(configs);
|
|
74120
|
+
* // configs is now a map of JSON data, e.g.
|
|
74121
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
74122
|
+
* }
|
|
74123
|
+
* });
|
|
74124
|
+
*
|
|
74125
|
+
* //Error handing
|
|
74126
|
+
* async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
|
|
74127
|
+
* if (err) {
|
|
74128
|
+
* console.error(err);
|
|
74129
|
+
* // JSON parse error exception
|
|
74130
|
+
* } else {
|
|
74131
|
+
* console.log(configs);
|
|
74132
|
+
* }
|
|
74133
|
+
* });
|
|
74134
|
+
*
|
|
74135
|
+
* // Using Promises
|
|
74136
|
+
* async.forEachOf(validConfigFileMap, parseFile)
|
|
74137
|
+
* .then( () => {
|
|
74138
|
+
* console.log(configs);
|
|
74139
|
+
* // configs is now a map of JSON data, e.g.
|
|
74140
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
74141
|
+
* }).catch( err => {
|
|
74142
|
+
* console.error(err);
|
|
74143
|
+
* });
|
|
74144
|
+
*
|
|
74145
|
+
* //Error handing
|
|
74146
|
+
* async.forEachOf(invalidConfigFileMap, parseFile)
|
|
74147
|
+
* .then( () => {
|
|
74148
|
+
* console.log(configs);
|
|
74149
|
+
* }).catch( err => {
|
|
74150
|
+
* console.error(err);
|
|
74151
|
+
* // JSON parse error exception
|
|
74106
74152
|
* });
|
|
74153
|
+
*
|
|
74154
|
+
* // Using async/await
|
|
74155
|
+
* async () => {
|
|
74156
|
+
* try {
|
|
74157
|
+
* let result = await async.forEachOf(validConfigFileMap, parseFile);
|
|
74158
|
+
* console.log(configs);
|
|
74159
|
+
* // configs is now a map of JSON data, e.g.
|
|
74160
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
74161
|
+
* }
|
|
74162
|
+
* catch (err) {
|
|
74163
|
+
* console.log(err);
|
|
74164
|
+
* }
|
|
74165
|
+
* }
|
|
74166
|
+
*
|
|
74167
|
+
* //Error handing
|
|
74168
|
+
* async () => {
|
|
74169
|
+
* try {
|
|
74170
|
+
* let result = await async.forEachOf(invalidConfigFileMap, parseFile);
|
|
74171
|
+
* console.log(configs);
|
|
74172
|
+
* }
|
|
74173
|
+
* catch (err) {
|
|
74174
|
+
* console.log(err);
|
|
74175
|
+
* // JSON parse error exception
|
|
74176
|
+
* }
|
|
74177
|
+
* }
|
|
74178
|
+
*
|
|
74107
74179
|
*/
|
|
74108
74180
|
function eachOf(coll, iteratee, callback) {
|
|
74109
74181
|
var eachOfImplementation = isArrayLike$1(coll) ? eachOfArrayLike : eachOfGeneric;
|
|
@@ -74145,9 +74217,89 @@ var eachOf$1 = awaitify(eachOf, 3);
|
|
|
74145
74217
|
* @returns {Promise} a promise, if no callback is passed
|
|
74146
74218
|
* @example
|
|
74147
74219
|
*
|
|
74148
|
-
*
|
|
74149
|
-
*
|
|
74220
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
74221
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
74222
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
74223
|
+
* // file4.txt does not exist
|
|
74224
|
+
*
|
|
74225
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
74226
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
74227
|
+
*
|
|
74228
|
+
* // asynchronous function that returns the file size in bytes
|
|
74229
|
+
* function getFileSizeInBytes(file, callback) {
|
|
74230
|
+
* fs.stat(file, function(err, stat) {
|
|
74231
|
+
* if (err) {
|
|
74232
|
+
* return callback(err);
|
|
74233
|
+
* }
|
|
74234
|
+
* callback(null, stat.size);
|
|
74235
|
+
* });
|
|
74236
|
+
* }
|
|
74237
|
+
*
|
|
74238
|
+
* // Using callbacks
|
|
74239
|
+
* async.map(fileList, getFileSizeInBytes, function(err, results) {
|
|
74240
|
+
* if (err) {
|
|
74241
|
+
* console.log(err);
|
|
74242
|
+
* } else {
|
|
74243
|
+
* console.log(results);
|
|
74244
|
+
* // results is now an array of the file size in bytes for each file, e.g.
|
|
74245
|
+
* // [ 1000, 2000, 3000]
|
|
74246
|
+
* }
|
|
74247
|
+
* });
|
|
74248
|
+
*
|
|
74249
|
+
* // Error Handling
|
|
74250
|
+
* async.map(withMissingFileList, getFileSizeInBytes, function(err, results) {
|
|
74251
|
+
* if (err) {
|
|
74252
|
+
* console.log(err);
|
|
74253
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
74254
|
+
* } else {
|
|
74255
|
+
* console.log(results);
|
|
74256
|
+
* }
|
|
74257
|
+
* });
|
|
74258
|
+
*
|
|
74259
|
+
* // Using Promises
|
|
74260
|
+
* async.map(fileList, getFileSizeInBytes)
|
|
74261
|
+
* .then( results => {
|
|
74262
|
+
* console.log(results);
|
|
74263
|
+
* // results is now an array of the file size in bytes for each file, e.g.
|
|
74264
|
+
* // [ 1000, 2000, 3000]
|
|
74265
|
+
* }).catch( err => {
|
|
74266
|
+
* console.log(err);
|
|
74150
74267
|
* });
|
|
74268
|
+
*
|
|
74269
|
+
* // Error Handling
|
|
74270
|
+
* async.map(withMissingFileList, getFileSizeInBytes)
|
|
74271
|
+
* .then( results => {
|
|
74272
|
+
* console.log(results);
|
|
74273
|
+
* }).catch( err => {
|
|
74274
|
+
* console.log(err);
|
|
74275
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
74276
|
+
* });
|
|
74277
|
+
*
|
|
74278
|
+
* // Using async/await
|
|
74279
|
+
* async () => {
|
|
74280
|
+
* try {
|
|
74281
|
+
* let results = await async.map(fileList, getFileSizeInBytes);
|
|
74282
|
+
* console.log(results);
|
|
74283
|
+
* // results is now an array of the file size in bytes for each file, e.g.
|
|
74284
|
+
* // [ 1000, 2000, 3000]
|
|
74285
|
+
* }
|
|
74286
|
+
* catch (err) {
|
|
74287
|
+
* console.log(err);
|
|
74288
|
+
* }
|
|
74289
|
+
* }
|
|
74290
|
+
*
|
|
74291
|
+
* // Error Handling
|
|
74292
|
+
* async () => {
|
|
74293
|
+
* try {
|
|
74294
|
+
* let results = await async.map(withMissingFileList, getFileSizeInBytes);
|
|
74295
|
+
* console.log(results);
|
|
74296
|
+
* }
|
|
74297
|
+
* catch (err) {
|
|
74298
|
+
* console.log(err);
|
|
74299
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
74300
|
+
* }
|
|
74301
|
+
* }
|
|
74302
|
+
*
|
|
74151
74303
|
*/
|
|
74152
74304
|
function map$1 (coll, iteratee, callback) {
|
|
74153
74305
|
return _asyncMap(eachOf$1, coll, iteratee, callback)
|
|
@@ -74321,15 +74473,40 @@ function promiseCallback () {
|
|
|
74321
74473
|
* @returns {Promise} a promise, if a callback is not passed
|
|
74322
74474
|
* @example
|
|
74323
74475
|
*
|
|
74476
|
+
* //Using Callbacks
|
|
74324
74477
|
* async.auto({
|
|
74325
|
-
*
|
|
74326
|
-
*
|
|
74327
|
-
*
|
|
74328
|
-
*
|
|
74329
|
-
*
|
|
74478
|
+
* get_data: function(callback) {
|
|
74479
|
+
* // async code to get some data
|
|
74480
|
+
* callback(null, 'data', 'converted to array');
|
|
74481
|
+
* },
|
|
74482
|
+
* make_folder: function(callback) {
|
|
74483
|
+
* // async code to create a directory to store a file in
|
|
74484
|
+
* // this is run at the same time as getting the data
|
|
74485
|
+
* callback(null, 'folder');
|
|
74486
|
+
* },
|
|
74487
|
+
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
74488
|
+
* // once there is some data and the directory exists,
|
|
74489
|
+
* // write the data to a file in the directory
|
|
74490
|
+
* callback(null, 'filename');
|
|
74491
|
+
* }],
|
|
74492
|
+
* email_link: ['write_file', function(results, callback) {
|
|
74493
|
+
* // once the file is written let's email a link to it...
|
|
74494
|
+
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
74330
74495
|
* }]
|
|
74331
|
-
* },
|
|
74496
|
+
* }, function(err, results) {
|
|
74497
|
+
* if (err) {
|
|
74498
|
+
* console.log('err = ', err);
|
|
74499
|
+
* }
|
|
74500
|
+
* console.log('results = ', results);
|
|
74501
|
+
* // results = {
|
|
74502
|
+
* // get_data: ['data', 'converted to array']
|
|
74503
|
+
* // make_folder; 'folder',
|
|
74504
|
+
* // write_file: 'filename'
|
|
74505
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
74506
|
+
* // }
|
|
74507
|
+
* });
|
|
74332
74508
|
*
|
|
74509
|
+
* //Using Promises
|
|
74333
74510
|
* async.auto({
|
|
74334
74511
|
* get_data: function(callback) {
|
|
74335
74512
|
* console.log('in get_data');
|
|
@@ -74343,21 +74520,62 @@ function promiseCallback () {
|
|
|
74343
74520
|
* callback(null, 'folder');
|
|
74344
74521
|
* },
|
|
74345
74522
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
74346
|
-
* console.log('in write_file', JSON.stringify(results));
|
|
74347
74523
|
* // once there is some data and the directory exists,
|
|
74348
74524
|
* // write the data to a file in the directory
|
|
74349
74525
|
* callback(null, 'filename');
|
|
74350
74526
|
* }],
|
|
74351
74527
|
* email_link: ['write_file', function(results, callback) {
|
|
74352
|
-
* console.log('in email_link', JSON.stringify(results));
|
|
74353
74528
|
* // once the file is written let's email a link to it...
|
|
74354
|
-
* // results.write_file contains the filename returned by write_file.
|
|
74355
74529
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
74356
74530
|
* }]
|
|
74357
|
-
* }
|
|
74358
|
-
* console.log('err = ', err);
|
|
74531
|
+
* }).then(results => {
|
|
74359
74532
|
* console.log('results = ', results);
|
|
74533
|
+
* // results = {
|
|
74534
|
+
* // get_data: ['data', 'converted to array']
|
|
74535
|
+
* // make_folder; 'folder',
|
|
74536
|
+
* // write_file: 'filename'
|
|
74537
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
74538
|
+
* // }
|
|
74539
|
+
* }).catch(err => {
|
|
74540
|
+
* console.log('err = ', err);
|
|
74360
74541
|
* });
|
|
74542
|
+
*
|
|
74543
|
+
* //Using async/await
|
|
74544
|
+
* async () => {
|
|
74545
|
+
* try {
|
|
74546
|
+
* let results = await async.auto({
|
|
74547
|
+
* get_data: function(callback) {
|
|
74548
|
+
* // async code to get some data
|
|
74549
|
+
* callback(null, 'data', 'converted to array');
|
|
74550
|
+
* },
|
|
74551
|
+
* make_folder: function(callback) {
|
|
74552
|
+
* // async code to create a directory to store a file in
|
|
74553
|
+
* // this is run at the same time as getting the data
|
|
74554
|
+
* callback(null, 'folder');
|
|
74555
|
+
* },
|
|
74556
|
+
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
74557
|
+
* // once there is some data and the directory exists,
|
|
74558
|
+
* // write the data to a file in the directory
|
|
74559
|
+
* callback(null, 'filename');
|
|
74560
|
+
* }],
|
|
74561
|
+
* email_link: ['write_file', function(results, callback) {
|
|
74562
|
+
* // once the file is written let's email a link to it...
|
|
74563
|
+
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
74564
|
+
* }]
|
|
74565
|
+
* });
|
|
74566
|
+
* console.log('results = ', results);
|
|
74567
|
+
* // results = {
|
|
74568
|
+
* // get_data: ['data', 'converted to array']
|
|
74569
|
+
* // make_folder; 'folder',
|
|
74570
|
+
* // write_file: 'filename'
|
|
74571
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
74572
|
+
* // }
|
|
74573
|
+
* }
|
|
74574
|
+
* catch (err) {
|
|
74575
|
+
* console.log(err);
|
|
74576
|
+
* }
|
|
74577
|
+
* }
|
|
74578
|
+
*
|
|
74361
74579
|
*/
|
|
74362
74580
|
function auto(tasks, concurrency, callback) {
|
|
74363
74581
|
if (typeof concurrency !== 'number') {
|
|
@@ -75165,7 +75383,7 @@ function cargo$1(worker, concurrency, payload) {
|
|
|
75165
75383
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
75166
75384
|
* array to produce the next step in the reduction.
|
|
75167
75385
|
* The `iteratee` should complete with the next state of the reduction.
|
|
75168
|
-
* If the iteratee
|
|
75386
|
+
* If the iteratee completes with an error, the reduction is stopped and the
|
|
75169
75387
|
* main `callback` is immediately called with the error.
|
|
75170
75388
|
* Invoked with (memo, item, callback).
|
|
75171
75389
|
* @param {Function} [callback] - A callback which is called after all the
|
|
@@ -75174,14 +75392,90 @@ function cargo$1(worker, concurrency, payload) {
|
|
|
75174
75392
|
* @returns {Promise} a promise, if no callback is passed
|
|
75175
75393
|
* @example
|
|
75176
75394
|
*
|
|
75177
|
-
*
|
|
75178
|
-
*
|
|
75179
|
-
*
|
|
75180
|
-
*
|
|
75395
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
75396
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
75397
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
75398
|
+
* // file4.txt does not exist
|
|
75399
|
+
*
|
|
75400
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
75401
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
|
|
75402
|
+
*
|
|
75403
|
+
* // asynchronous function that computes the file size in bytes
|
|
75404
|
+
* // file size is added to the memoized value, then returned
|
|
75405
|
+
* function getFileSizeInBytes(memo, file, callback) {
|
|
75406
|
+
* fs.stat(file, function(err, stat) {
|
|
75407
|
+
* if (err) {
|
|
75408
|
+
* return callback(err);
|
|
75409
|
+
* }
|
|
75410
|
+
* callback(null, memo + stat.size);
|
|
75181
75411
|
* });
|
|
75182
|
-
* }
|
|
75183
|
-
*
|
|
75412
|
+
* }
|
|
75413
|
+
*
|
|
75414
|
+
* // Using callbacks
|
|
75415
|
+
* async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
|
|
75416
|
+
* if (err) {
|
|
75417
|
+
* console.log(err);
|
|
75418
|
+
* } else {
|
|
75419
|
+
* console.log(result);
|
|
75420
|
+
* // 6000
|
|
75421
|
+
* // which is the sum of the file sizes of the three files
|
|
75422
|
+
* }
|
|
75423
|
+
* });
|
|
75424
|
+
*
|
|
75425
|
+
* // Error Handling
|
|
75426
|
+
* async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
|
|
75427
|
+
* if (err) {
|
|
75428
|
+
* console.log(err);
|
|
75429
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75430
|
+
* } else {
|
|
75431
|
+
* console.log(result);
|
|
75432
|
+
* }
|
|
75433
|
+
* });
|
|
75434
|
+
*
|
|
75435
|
+
* // Using Promises
|
|
75436
|
+
* async.reduce(fileList, 0, getFileSizeInBytes)
|
|
75437
|
+
* .then( result => {
|
|
75438
|
+
* console.log(result);
|
|
75439
|
+
* // 6000
|
|
75440
|
+
* // which is the sum of the file sizes of the three files
|
|
75441
|
+
* }).catch( err => {
|
|
75442
|
+
* console.log(err);
|
|
75184
75443
|
* });
|
|
75444
|
+
*
|
|
75445
|
+
* // Error Handling
|
|
75446
|
+
* async.reduce(withMissingFileList, 0, getFileSizeInBytes)
|
|
75447
|
+
* .then( result => {
|
|
75448
|
+
* console.log(result);
|
|
75449
|
+
* }).catch( err => {
|
|
75450
|
+
* console.log(err);
|
|
75451
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75452
|
+
* });
|
|
75453
|
+
*
|
|
75454
|
+
* // Using async/await
|
|
75455
|
+
* async () => {
|
|
75456
|
+
* try {
|
|
75457
|
+
* let result = await async.reduce(fileList, 0, getFileSizeInBytes);
|
|
75458
|
+
* console.log(result);
|
|
75459
|
+
* // 6000
|
|
75460
|
+
* // which is the sum of the file sizes of the three files
|
|
75461
|
+
* }
|
|
75462
|
+
* catch (err) {
|
|
75463
|
+
* console.log(err);
|
|
75464
|
+
* }
|
|
75465
|
+
* }
|
|
75466
|
+
*
|
|
75467
|
+
* // Error Handling
|
|
75468
|
+
* async () => {
|
|
75469
|
+
* try {
|
|
75470
|
+
* let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
|
|
75471
|
+
* console.log(result);
|
|
75472
|
+
* }
|
|
75473
|
+
* catch (err) {
|
|
75474
|
+
* console.log(err);
|
|
75475
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75476
|
+
* }
|
|
75477
|
+
* }
|
|
75478
|
+
*
|
|
75185
75479
|
*/
|
|
75186
75480
|
function reduce(coll, memo, iteratee, callback) {
|
|
75187
75481
|
callback = once(callback);
|
|
@@ -75385,9 +75679,77 @@ var concatLimit$1 = awaitify(concatLimit, 4);
|
|
|
75385
75679
|
* @returns A Promise, if no callback is passed
|
|
75386
75680
|
* @example
|
|
75387
75681
|
*
|
|
75388
|
-
*
|
|
75389
|
-
*
|
|
75682
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
75683
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
75684
|
+
* // dir3 is a directory that contains file5.txt
|
|
75685
|
+
* // dir4 does not exist
|
|
75686
|
+
*
|
|
75687
|
+
* let directoryList = ['dir1','dir2','dir3'];
|
|
75688
|
+
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
|
|
75689
|
+
*
|
|
75690
|
+
* // Using callbacks
|
|
75691
|
+
* async.concat(directoryList, fs.readdir, function(err, results) {
|
|
75692
|
+
* if (err) {
|
|
75693
|
+
* console.log(err);
|
|
75694
|
+
* } else {
|
|
75695
|
+
* console.log(results);
|
|
75696
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
75697
|
+
* }
|
|
75698
|
+
* });
|
|
75699
|
+
*
|
|
75700
|
+
* // Error Handling
|
|
75701
|
+
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
|
|
75702
|
+
* if (err) {
|
|
75703
|
+
* console.log(err);
|
|
75704
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75705
|
+
* // since dir4 does not exist
|
|
75706
|
+
* } else {
|
|
75707
|
+
* console.log(results);
|
|
75708
|
+
* }
|
|
75709
|
+
* });
|
|
75710
|
+
*
|
|
75711
|
+
* // Using Promises
|
|
75712
|
+
* async.concat(directoryList, fs.readdir)
|
|
75713
|
+
* .then(results => {
|
|
75714
|
+
* console.log(results);
|
|
75715
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
75716
|
+
* }).catch(err => {
|
|
75717
|
+
* console.log(err);
|
|
75718
|
+
* });
|
|
75719
|
+
*
|
|
75720
|
+
* // Error Handling
|
|
75721
|
+
* async.concat(withMissingDirectoryList, fs.readdir)
|
|
75722
|
+
* .then(results => {
|
|
75723
|
+
* console.log(results);
|
|
75724
|
+
* }).catch(err => {
|
|
75725
|
+
* console.log(err);
|
|
75726
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75727
|
+
* // since dir4 does not exist
|
|
75390
75728
|
* });
|
|
75729
|
+
*
|
|
75730
|
+
* // Using async/await
|
|
75731
|
+
* async () => {
|
|
75732
|
+
* try {
|
|
75733
|
+
* let results = await async.concat(directoryList, fs.readdir);
|
|
75734
|
+
* console.log(results);
|
|
75735
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
75736
|
+
* } catch (err) {
|
|
75737
|
+
* console.log(err);
|
|
75738
|
+
* }
|
|
75739
|
+
* }
|
|
75740
|
+
*
|
|
75741
|
+
* // Error Handling
|
|
75742
|
+
* async () => {
|
|
75743
|
+
* try {
|
|
75744
|
+
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
|
|
75745
|
+
* console.log(results);
|
|
75746
|
+
* } catch (err) {
|
|
75747
|
+
* console.log(err);
|
|
75748
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75749
|
+
* // since dir4 does not exist
|
|
75750
|
+
* }
|
|
75751
|
+
* }
|
|
75752
|
+
*
|
|
75391
75753
|
*/
|
|
75392
75754
|
function concat(coll, iteratee, callback) {
|
|
75393
75755
|
return concatLimit$1(coll, Infinity, iteratee, callback)
|
|
@@ -75519,13 +75881,48 @@ function _createTester(check, getResult) {
|
|
|
75519
75881
|
* @returns A Promise, if no callback is passed
|
|
75520
75882
|
* @example
|
|
75521
75883
|
*
|
|
75522
|
-
*
|
|
75523
|
-
*
|
|
75524
|
-
*
|
|
75525
|
-
*
|
|
75526
|
-
*
|
|
75884
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
75885
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
75886
|
+
* // dir3 is a directory that contains file5.txt
|
|
75887
|
+
*
|
|
75888
|
+
* // asynchronous function that checks if a file exists
|
|
75889
|
+
* function fileExists(file, callback) {
|
|
75890
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
75891
|
+
* callback(null, !err);
|
|
75892
|
+
* });
|
|
75893
|
+
* }
|
|
75894
|
+
*
|
|
75895
|
+
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
|
|
75896
|
+
* function(err, result) {
|
|
75897
|
+
* console.log(result);
|
|
75898
|
+
* // dir1/file1.txt
|
|
75899
|
+
* // result now equals the first file in the list that exists
|
|
75900
|
+
* }
|
|
75901
|
+
*);
|
|
75902
|
+
*
|
|
75903
|
+
* // Using Promises
|
|
75904
|
+
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
|
|
75905
|
+
* .then(result => {
|
|
75906
|
+
* console.log(result);
|
|
75907
|
+
* // dir1/file1.txt
|
|
75527
75908
|
* // result now equals the first file in the list that exists
|
|
75909
|
+
* }).catch(err => {
|
|
75910
|
+
* console.log(err);
|
|
75528
75911
|
* });
|
|
75912
|
+
*
|
|
75913
|
+
* // Using async/await
|
|
75914
|
+
* async () => {
|
|
75915
|
+
* try {
|
|
75916
|
+
* let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
|
|
75917
|
+
* console.log(result);
|
|
75918
|
+
* // dir1/file1.txt
|
|
75919
|
+
* // result now equals the file in the list that exists
|
|
75920
|
+
* }
|
|
75921
|
+
* catch (err) {
|
|
75922
|
+
* console.log(err);
|
|
75923
|
+
* }
|
|
75924
|
+
* }
|
|
75925
|
+
*
|
|
75529
75926
|
*/
|
|
75530
75927
|
function detect(coll, iteratee, callback) {
|
|
75531
75928
|
return _createTester(bool => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback)
|
|
@@ -75589,12 +75986,15 @@ var detectSeries$1 = awaitify(detectSeries, 3);
|
|
|
75589
75986
|
|
|
75590
75987
|
function consoleFunc(name) {
|
|
75591
75988
|
return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
|
|
75989
|
+
/* istanbul ignore else */
|
|
75592
75990
|
if (typeof console === 'object') {
|
|
75991
|
+
/* istanbul ignore else */
|
|
75593
75992
|
if (err) {
|
|
75993
|
+
/* istanbul ignore else */
|
|
75594
75994
|
if (console.error) {
|
|
75595
75995
|
console.error(err);
|
|
75596
75996
|
}
|
|
75597
|
-
} else if (console[name]) {
|
|
75997
|
+
} else if (console[name]) { /* istanbul ignore else */
|
|
75598
75998
|
resultArgs.forEach(x => console[name](x));
|
|
75599
75999
|
}
|
|
75600
76000
|
}
|
|
@@ -75739,37 +76139,78 @@ function _withoutIndex(iteratee) {
|
|
|
75739
76139
|
* @returns {Promise} a promise, if a callback is omitted
|
|
75740
76140
|
* @example
|
|
75741
76141
|
*
|
|
75742
|
-
* //
|
|
75743
|
-
* //
|
|
75744
|
-
*
|
|
75745
|
-
*
|
|
75746
|
-
* // if any of the saves produced an error, err would equal that error
|
|
75747
|
-
* });
|
|
76142
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76143
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76144
|
+
* // dir3 is a directory that contains file5.txt
|
|
76145
|
+
* // dir4 does not exist
|
|
75748
76146
|
*
|
|
75749
|
-
*
|
|
75750
|
-
*
|
|
76147
|
+
* const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
|
|
76148
|
+
* const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
|
|
75751
76149
|
*
|
|
75752
|
-
*
|
|
75753
|
-
*
|
|
76150
|
+
* // asynchronous function that deletes a file
|
|
76151
|
+
* const deleteFile = function(file, callback) {
|
|
76152
|
+
* fs.unlink(file, callback);
|
|
76153
|
+
* };
|
|
75754
76154
|
*
|
|
75755
|
-
*
|
|
75756
|
-
*
|
|
75757
|
-
* callback('File name too long');
|
|
75758
|
-
* } else {
|
|
75759
|
-
* // Do work to process file here
|
|
75760
|
-
* console.log('File processed');
|
|
75761
|
-
* callback();
|
|
75762
|
-
* }
|
|
75763
|
-
* }, function(err) {
|
|
75764
|
-
* // if any of the file processing produced an error, err would equal that error
|
|
76155
|
+
* // Using callbacks
|
|
76156
|
+
* async.each(fileList, deleteFile, function(err) {
|
|
75765
76157
|
* if( err ) {
|
|
75766
|
-
*
|
|
75767
|
-
* // All processing will now stop.
|
|
75768
|
-
* console.log('A file failed to process');
|
|
76158
|
+
* console.log(err);
|
|
75769
76159
|
* } else {
|
|
75770
|
-
*
|
|
76160
|
+
* console.log('All files have been deleted successfully');
|
|
75771
76161
|
* }
|
|
75772
76162
|
* });
|
|
76163
|
+
*
|
|
76164
|
+
* // Error Handling
|
|
76165
|
+
* async.each(withMissingFileList, deleteFile, function(err){
|
|
76166
|
+
* console.log(err);
|
|
76167
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76168
|
+
* // since dir4/file2.txt does not exist
|
|
76169
|
+
* // dir1/file1.txt could have been deleted
|
|
76170
|
+
* });
|
|
76171
|
+
*
|
|
76172
|
+
* // Using Promises
|
|
76173
|
+
* async.each(fileList, deleteFile)
|
|
76174
|
+
* .then( () => {
|
|
76175
|
+
* console.log('All files have been deleted successfully');
|
|
76176
|
+
* }).catch( err => {
|
|
76177
|
+
* console.log(err);
|
|
76178
|
+
* });
|
|
76179
|
+
*
|
|
76180
|
+
* // Error Handling
|
|
76181
|
+
* async.each(fileList, deleteFile)
|
|
76182
|
+
* .then( () => {
|
|
76183
|
+
* console.log('All files have been deleted successfully');
|
|
76184
|
+
* }).catch( err => {
|
|
76185
|
+
* console.log(err);
|
|
76186
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76187
|
+
* // since dir4/file2.txt does not exist
|
|
76188
|
+
* // dir1/file1.txt could have been deleted
|
|
76189
|
+
* });
|
|
76190
|
+
*
|
|
76191
|
+
* // Using async/await
|
|
76192
|
+
* async () => {
|
|
76193
|
+
* try {
|
|
76194
|
+
* await async.each(files, deleteFile);
|
|
76195
|
+
* }
|
|
76196
|
+
* catch (err) {
|
|
76197
|
+
* console.log(err);
|
|
76198
|
+
* }
|
|
76199
|
+
* }
|
|
76200
|
+
*
|
|
76201
|
+
* // Error Handling
|
|
76202
|
+
* async () => {
|
|
76203
|
+
* try {
|
|
76204
|
+
* await async.each(withMissingFileList, deleteFile);
|
|
76205
|
+
* }
|
|
76206
|
+
* catch (err) {
|
|
76207
|
+
* console.log(err);
|
|
76208
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76209
|
+
* // since dir4/file2.txt does not exist
|
|
76210
|
+
* // dir1/file1.txt could have been deleted
|
|
76211
|
+
* }
|
|
76212
|
+
* }
|
|
76213
|
+
*
|
|
75773
76214
|
*/
|
|
75774
76215
|
function eachLimit(coll, iteratee, callback) {
|
|
75775
76216
|
return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
|
|
@@ -75904,13 +76345,78 @@ function ensureAsync(fn) {
|
|
|
75904
76345
|
* @returns {Promise} a promise, if no callback provided
|
|
75905
76346
|
* @example
|
|
75906
76347
|
*
|
|
75907
|
-
*
|
|
75908
|
-
*
|
|
75909
|
-
*
|
|
75910
|
-
*
|
|
75911
|
-
*
|
|
75912
|
-
*
|
|
76348
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76349
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76350
|
+
* // dir3 is a directory that contains file5.txt
|
|
76351
|
+
* // dir4 does not exist
|
|
76352
|
+
*
|
|
76353
|
+
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
|
76354
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
76355
|
+
*
|
|
76356
|
+
* // asynchronous function that checks if a file exists
|
|
76357
|
+
* function fileExists(file, callback) {
|
|
76358
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
76359
|
+
* callback(null, !err);
|
|
76360
|
+
* });
|
|
76361
|
+
* }
|
|
76362
|
+
*
|
|
76363
|
+
* // Using callbacks
|
|
76364
|
+
* async.every(fileList, fileExists, function(err, result) {
|
|
76365
|
+
* console.log(result);
|
|
76366
|
+
* // true
|
|
76367
|
+
* // result is true since every file exists
|
|
76368
|
+
* });
|
|
76369
|
+
*
|
|
76370
|
+
* async.every(withMissingFileList, fileExists, function(err, result) {
|
|
76371
|
+
* console.log(result);
|
|
76372
|
+
* // false
|
|
76373
|
+
* // result is false since NOT every file exists
|
|
76374
|
+
* });
|
|
76375
|
+
*
|
|
76376
|
+
* // Using Promises
|
|
76377
|
+
* async.every(fileList, fileExists)
|
|
76378
|
+
* .then( result => {
|
|
76379
|
+
* console.log(result);
|
|
76380
|
+
* // true
|
|
76381
|
+
* // result is true since every file exists
|
|
76382
|
+
* }).catch( err => {
|
|
76383
|
+
* console.log(err);
|
|
75913
76384
|
* });
|
|
76385
|
+
*
|
|
76386
|
+
* async.every(withMissingFileList, fileExists)
|
|
76387
|
+
* .then( result => {
|
|
76388
|
+
* console.log(result);
|
|
76389
|
+
* // false
|
|
76390
|
+
* // result is false since NOT every file exists
|
|
76391
|
+
* }).catch( err => {
|
|
76392
|
+
* console.log(err);
|
|
76393
|
+
* });
|
|
76394
|
+
*
|
|
76395
|
+
* // Using async/await
|
|
76396
|
+
* async () => {
|
|
76397
|
+
* try {
|
|
76398
|
+
* let result = await async.every(fileList, fileExists);
|
|
76399
|
+
* console.log(result);
|
|
76400
|
+
* // true
|
|
76401
|
+
* // result is true since every file exists
|
|
76402
|
+
* }
|
|
76403
|
+
* catch (err) {
|
|
76404
|
+
* console.log(err);
|
|
76405
|
+
* }
|
|
76406
|
+
* }
|
|
76407
|
+
*
|
|
76408
|
+
* async () => {
|
|
76409
|
+
* try {
|
|
76410
|
+
* let result = await async.every(withMissingFileList, fileExists);
|
|
76411
|
+
* console.log(result);
|
|
76412
|
+
* // false
|
|
76413
|
+
* // result is false since NOT every file exists
|
|
76414
|
+
* }
|
|
76415
|
+
* catch (err) {
|
|
76416
|
+
* console.log(err);
|
|
76417
|
+
* }
|
|
76418
|
+
* }
|
|
76419
|
+
*
|
|
75914
76420
|
*/
|
|
75915
76421
|
function every(coll, iteratee, callback) {
|
|
75916
76422
|
return _createTester(bool => !bool, res => !res)(eachOf$1, coll, iteratee, callback)
|
|
@@ -76028,13 +76534,53 @@ function _filter(eachfn, coll, iteratee, callback) {
|
|
|
76028
76534
|
* @returns {Promise} a promise, if no callback provided
|
|
76029
76535
|
* @example
|
|
76030
76536
|
*
|
|
76031
|
-
*
|
|
76032
|
-
*
|
|
76033
|
-
*
|
|
76034
|
-
*
|
|
76035
|
-
*
|
|
76036
|
-
*
|
|
76537
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76538
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76539
|
+
* // dir3 is a directory that contains file5.txt
|
|
76540
|
+
*
|
|
76541
|
+
* const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
|
76542
|
+
*
|
|
76543
|
+
* // asynchronous function that checks if a file exists
|
|
76544
|
+
* function fileExists(file, callback) {
|
|
76545
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
76546
|
+
* callback(null, !err);
|
|
76547
|
+
* });
|
|
76548
|
+
* }
|
|
76549
|
+
*
|
|
76550
|
+
* // Using callbacks
|
|
76551
|
+
* async.filter(files, fileExists, function(err, results) {
|
|
76552
|
+
* if(err) {
|
|
76553
|
+
* console.log(err);
|
|
76554
|
+
* } else {
|
|
76555
|
+
* console.log(results);
|
|
76556
|
+
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
76557
|
+
* // results is now an array of the existing files
|
|
76558
|
+
* }
|
|
76559
|
+
* });
|
|
76560
|
+
*
|
|
76561
|
+
* // Using Promises
|
|
76562
|
+
* async.filter(files, fileExists)
|
|
76563
|
+
* .then(results => {
|
|
76564
|
+
* console.log(results);
|
|
76565
|
+
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
76566
|
+
* // results is now an array of the existing files
|
|
76567
|
+
* }).catch(err => {
|
|
76568
|
+
* console.log(err);
|
|
76037
76569
|
* });
|
|
76570
|
+
*
|
|
76571
|
+
* // Using async/await
|
|
76572
|
+
* async () => {
|
|
76573
|
+
* try {
|
|
76574
|
+
* let results = await async.filter(files, fileExists);
|
|
76575
|
+
* console.log(results);
|
|
76576
|
+
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
76577
|
+
* // results is now an array of the existing files
|
|
76578
|
+
* }
|
|
76579
|
+
* catch (err) {
|
|
76580
|
+
* console.log(err);
|
|
76581
|
+
* }
|
|
76582
|
+
* }
|
|
76583
|
+
*
|
|
76038
76584
|
*/
|
|
76039
76585
|
function filter$1 (coll, iteratee, callback) {
|
|
76040
76586
|
return _filter(eachOf$1, coll, iteratee, callback)
|
|
@@ -76211,15 +76757,69 @@ var groupByLimit$1 = awaitify(groupByLimit, 4);
|
|
|
76211
76757
|
* @returns {Promise} a promise, if no callback is passed
|
|
76212
76758
|
* @example
|
|
76213
76759
|
*
|
|
76214
|
-
*
|
|
76215
|
-
*
|
|
76216
|
-
*
|
|
76217
|
-
*
|
|
76760
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76761
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76762
|
+
* // dir3 is a directory that contains file5.txt
|
|
76763
|
+
* // dir4 does not exist
|
|
76764
|
+
*
|
|
76765
|
+
* const files = ['dir1/file1.txt','dir2','dir4']
|
|
76766
|
+
*
|
|
76767
|
+
* // asynchronous function that detects file type as none, file, or directory
|
|
76768
|
+
* function detectFile(file, callback) {
|
|
76769
|
+
* fs.stat(file, function(err, stat) {
|
|
76770
|
+
* if (err) {
|
|
76771
|
+
* return callback(null, 'none');
|
|
76772
|
+
* }
|
|
76773
|
+
* callback(null, stat.isDirectory() ? 'directory' : 'file');
|
|
76218
76774
|
* });
|
|
76219
|
-
* }
|
|
76220
|
-
*
|
|
76221
|
-
*
|
|
76775
|
+
* }
|
|
76776
|
+
*
|
|
76777
|
+
* //Using callbacks
|
|
76778
|
+
* async.groupBy(files, detectFile, function(err, result) {
|
|
76779
|
+
* if(err) {
|
|
76780
|
+
* console.log(err);
|
|
76781
|
+
* } else {
|
|
76782
|
+
* console.log(result);
|
|
76783
|
+
* // {
|
|
76784
|
+
* // file: [ 'dir1/file1.txt' ],
|
|
76785
|
+
* // none: [ 'dir4' ],
|
|
76786
|
+
* // directory: [ 'dir2']
|
|
76787
|
+
* // }
|
|
76788
|
+
* // result is object containing the files grouped by type
|
|
76789
|
+
* }
|
|
76222
76790
|
* });
|
|
76791
|
+
*
|
|
76792
|
+
* // Using Promises
|
|
76793
|
+
* async.groupBy(files, detectFile)
|
|
76794
|
+
* .then( result => {
|
|
76795
|
+
* console.log(result);
|
|
76796
|
+
* // {
|
|
76797
|
+
* // file: [ 'dir1/file1.txt' ],
|
|
76798
|
+
* // none: [ 'dir4' ],
|
|
76799
|
+
* // directory: [ 'dir2']
|
|
76800
|
+
* // }
|
|
76801
|
+
* // result is object containing the files grouped by type
|
|
76802
|
+
* }).catch( err => {
|
|
76803
|
+
* console.log(err);
|
|
76804
|
+
* });
|
|
76805
|
+
*
|
|
76806
|
+
* // Using async/await
|
|
76807
|
+
* async () => {
|
|
76808
|
+
* try {
|
|
76809
|
+
* let result = await async.groupBy(files, detectFile);
|
|
76810
|
+
* console.log(result);
|
|
76811
|
+
* // {
|
|
76812
|
+
* // file: [ 'dir1/file1.txt' ],
|
|
76813
|
+
* // none: [ 'dir4' ],
|
|
76814
|
+
* // directory: [ 'dir2']
|
|
76815
|
+
* // }
|
|
76816
|
+
* // result is object containing the files grouped by type
|
|
76817
|
+
* }
|
|
76818
|
+
* catch (err) {
|
|
76819
|
+
* console.log(err);
|
|
76820
|
+
* }
|
|
76821
|
+
* }
|
|
76822
|
+
*
|
|
76223
76823
|
*/
|
|
76224
76824
|
function groupBy$1 (coll, iteratee, callback) {
|
|
76225
76825
|
return groupByLimit$1(coll, Infinity, iteratee, callback)
|
|
@@ -76240,7 +76840,7 @@ function groupBy$1 (coll, iteratee, callback) {
|
|
|
76240
76840
|
* The iteratee should complete with a `key` to group the value under.
|
|
76241
76841
|
* Invoked with (value, callback).
|
|
76242
76842
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
76243
|
-
* functions have finished, or an error occurs. Result is an `Object`
|
|
76843
|
+
* functions have finished, or an error occurs. Result is an `Object` whose
|
|
76244
76844
|
* properties are arrays of values which returned the corresponding key.
|
|
76245
76845
|
* @returns {Promise} a promise, if no callback is passed
|
|
76246
76846
|
*/
|
|
@@ -76344,20 +76944,110 @@ var mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
|
|
|
76344
76944
|
* @returns {Promise} a promise, if no callback is passed
|
|
76345
76945
|
* @example
|
|
76346
76946
|
*
|
|
76347
|
-
*
|
|
76348
|
-
*
|
|
76349
|
-
*
|
|
76350
|
-
*
|
|
76351
|
-
*
|
|
76352
|
-
*
|
|
76353
|
-
*
|
|
76354
|
-
*
|
|
76947
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
76948
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
76949
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
76950
|
+
* // file4.txt does not exist
|
|
76951
|
+
*
|
|
76952
|
+
* const fileMap = {
|
|
76953
|
+
* f1: 'file1.txt',
|
|
76954
|
+
* f2: 'file2.txt',
|
|
76955
|
+
* f3: 'file3.txt'
|
|
76956
|
+
* };
|
|
76957
|
+
*
|
|
76958
|
+
* const withMissingFileMap = {
|
|
76959
|
+
* f1: 'file1.txt',
|
|
76960
|
+
* f2: 'file2.txt',
|
|
76961
|
+
* f3: 'file4.txt'
|
|
76962
|
+
* };
|
|
76963
|
+
*
|
|
76964
|
+
* // asynchronous function that returns the file size in bytes
|
|
76965
|
+
* function getFileSizeInBytes(file, key, callback) {
|
|
76966
|
+
* fs.stat(file, function(err, stat) {
|
|
76967
|
+
* if (err) {
|
|
76968
|
+
* return callback(err);
|
|
76969
|
+
* }
|
|
76970
|
+
* callback(null, stat.size);
|
|
76971
|
+
* });
|
|
76972
|
+
* }
|
|
76973
|
+
*
|
|
76974
|
+
* // Using callbacks
|
|
76975
|
+
* async.mapValues(fileMap, getFileSizeInBytes, function(err, result) {
|
|
76976
|
+
* if (err) {
|
|
76977
|
+
* console.log(err);
|
|
76978
|
+
* } else {
|
|
76979
|
+
* console.log(result);
|
|
76980
|
+
* // result is now a map of file size in bytes for each file, e.g.
|
|
76981
|
+
* // {
|
|
76982
|
+
* // f1: 1000,
|
|
76983
|
+
* // f2: 2000,
|
|
76984
|
+
* // f3: 3000
|
|
76985
|
+
* // }
|
|
76986
|
+
* }
|
|
76987
|
+
* });
|
|
76988
|
+
*
|
|
76989
|
+
* // Error handling
|
|
76990
|
+
* async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) {
|
|
76991
|
+
* if (err) {
|
|
76992
|
+
* console.log(err);
|
|
76993
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76994
|
+
* } else {
|
|
76995
|
+
* console.log(result);
|
|
76996
|
+
* }
|
|
76997
|
+
* });
|
|
76998
|
+
*
|
|
76999
|
+
* // Using Promises
|
|
77000
|
+
* async.mapValues(fileMap, getFileSizeInBytes)
|
|
77001
|
+
* .then( result => {
|
|
77002
|
+
* console.log(result);
|
|
77003
|
+
* // result is now a map of file size in bytes for each file, e.g.
|
|
76355
77004
|
* // {
|
|
76356
|
-
* // f1:
|
|
76357
|
-
* // f2:
|
|
76358
|
-
* // f3:
|
|
77005
|
+
* // f1: 1000,
|
|
77006
|
+
* // f2: 2000,
|
|
77007
|
+
* // f3: 3000
|
|
76359
77008
|
* // }
|
|
77009
|
+
* }).catch (err => {
|
|
77010
|
+
* console.log(err);
|
|
77011
|
+
* });
|
|
77012
|
+
*
|
|
77013
|
+
* // Error Handling
|
|
77014
|
+
* async.mapValues(withMissingFileMap, getFileSizeInBytes)
|
|
77015
|
+
* .then( result => {
|
|
77016
|
+
* console.log(result);
|
|
77017
|
+
* }).catch (err => {
|
|
77018
|
+
* console.log(err);
|
|
77019
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76360
77020
|
* });
|
|
77021
|
+
*
|
|
77022
|
+
* // Using async/await
|
|
77023
|
+
* async () => {
|
|
77024
|
+
* try {
|
|
77025
|
+
* let result = await async.mapValues(fileMap, getFileSizeInBytes);
|
|
77026
|
+
* console.log(result);
|
|
77027
|
+
* // result is now a map of file size in bytes for each file, e.g.
|
|
77028
|
+
* // {
|
|
77029
|
+
* // f1: 1000,
|
|
77030
|
+
* // f2: 2000,
|
|
77031
|
+
* // f3: 3000
|
|
77032
|
+
* // }
|
|
77033
|
+
* }
|
|
77034
|
+
* catch (err) {
|
|
77035
|
+
* console.log(err);
|
|
77036
|
+
* }
|
|
77037
|
+
* }
|
|
77038
|
+
*
|
|
77039
|
+
* // Error Handling
|
|
77040
|
+
* async () => {
|
|
77041
|
+
* try {
|
|
77042
|
+
* let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes);
|
|
77043
|
+
* console.log(result);
|
|
77044
|
+
* }
|
|
77045
|
+
* catch (err) {
|
|
77046
|
+
* console.log(err);
|
|
77047
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
77048
|
+
* }
|
|
77049
|
+
* }
|
|
77050
|
+
*
|
|
76361
77051
|
*/
|
|
76362
77052
|
function mapValues(obj, iteratee, callback) {
|
|
76363
77053
|
return mapValuesLimit$1(obj, Infinity, iteratee, callback)
|
|
@@ -76550,6 +77240,8 @@ var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
|
76550
77240
|
* @returns {Promise} a promise, if a callback is not passed
|
|
76551
77241
|
*
|
|
76552
77242
|
* @example
|
|
77243
|
+
*
|
|
77244
|
+
* //Using Callbacks
|
|
76553
77245
|
* async.parallel([
|
|
76554
77246
|
* function(callback) {
|
|
76555
77247
|
* setTimeout(function() {
|
|
@@ -76561,10 +77253,9 @@ var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
|
76561
77253
|
* callback(null, 'two');
|
|
76562
77254
|
* }, 100);
|
|
76563
77255
|
* }
|
|
76564
|
-
* ],
|
|
76565
|
-
*
|
|
76566
|
-
*
|
|
76567
|
-
* // the results array will equal ['one','two'] even though
|
|
77256
|
+
* ], function(err, results) {
|
|
77257
|
+
* console.log(results);
|
|
77258
|
+
* // results is equal to ['one','two'] even though
|
|
76568
77259
|
* // the second function had a shorter timeout.
|
|
76569
77260
|
* });
|
|
76570
77261
|
*
|
|
@@ -76581,8 +77272,96 @@ var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
|
76581
77272
|
* }, 100);
|
|
76582
77273
|
* }
|
|
76583
77274
|
* }, function(err, results) {
|
|
76584
|
-
*
|
|
77275
|
+
* console.log(results);
|
|
77276
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
76585
77277
|
* });
|
|
77278
|
+
*
|
|
77279
|
+
* //Using Promises
|
|
77280
|
+
* async.parallel([
|
|
77281
|
+
* function(callback) {
|
|
77282
|
+
* setTimeout(function() {
|
|
77283
|
+
* callback(null, 'one');
|
|
77284
|
+
* }, 200);
|
|
77285
|
+
* },
|
|
77286
|
+
* function(callback) {
|
|
77287
|
+
* setTimeout(function() {
|
|
77288
|
+
* callback(null, 'two');
|
|
77289
|
+
* }, 100);
|
|
77290
|
+
* }
|
|
77291
|
+
* ]).then(results => {
|
|
77292
|
+
* console.log(results);
|
|
77293
|
+
* // results is equal to ['one','two'] even though
|
|
77294
|
+
* // the second function had a shorter timeout.
|
|
77295
|
+
* }).catch(err => {
|
|
77296
|
+
* console.log(err);
|
|
77297
|
+
* });
|
|
77298
|
+
*
|
|
77299
|
+
* // an example using an object instead of an array
|
|
77300
|
+
* async.parallel({
|
|
77301
|
+
* one: function(callback) {
|
|
77302
|
+
* setTimeout(function() {
|
|
77303
|
+
* callback(null, 1);
|
|
77304
|
+
* }, 200);
|
|
77305
|
+
* },
|
|
77306
|
+
* two: function(callback) {
|
|
77307
|
+
* setTimeout(function() {
|
|
77308
|
+
* callback(null, 2);
|
|
77309
|
+
* }, 100);
|
|
77310
|
+
* }
|
|
77311
|
+
* }).then(results => {
|
|
77312
|
+
* console.log(results);
|
|
77313
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
77314
|
+
* }).catch(err => {
|
|
77315
|
+
* console.log(err);
|
|
77316
|
+
* });
|
|
77317
|
+
*
|
|
77318
|
+
* //Using async/await
|
|
77319
|
+
* async () => {
|
|
77320
|
+
* try {
|
|
77321
|
+
* let results = await async.parallel([
|
|
77322
|
+
* function(callback) {
|
|
77323
|
+
* setTimeout(function() {
|
|
77324
|
+
* callback(null, 'one');
|
|
77325
|
+
* }, 200);
|
|
77326
|
+
* },
|
|
77327
|
+
* function(callback) {
|
|
77328
|
+
* setTimeout(function() {
|
|
77329
|
+
* callback(null, 'two');
|
|
77330
|
+
* }, 100);
|
|
77331
|
+
* }
|
|
77332
|
+
* ]);
|
|
77333
|
+
* console.log(results);
|
|
77334
|
+
* // results is equal to ['one','two'] even though
|
|
77335
|
+
* // the second function had a shorter timeout.
|
|
77336
|
+
* }
|
|
77337
|
+
* catch (err) {
|
|
77338
|
+
* console.log(err);
|
|
77339
|
+
* }
|
|
77340
|
+
* }
|
|
77341
|
+
*
|
|
77342
|
+
* // an example using an object instead of an array
|
|
77343
|
+
* async () => {
|
|
77344
|
+
* try {
|
|
77345
|
+
* let results = await async.parallel({
|
|
77346
|
+
* one: function(callback) {
|
|
77347
|
+
* setTimeout(function() {
|
|
77348
|
+
* callback(null, 1);
|
|
77349
|
+
* }, 200);
|
|
77350
|
+
* },
|
|
77351
|
+
* two: function(callback) {
|
|
77352
|
+
* setTimeout(function() {
|
|
77353
|
+
* callback(null, 2);
|
|
77354
|
+
* }, 100);
|
|
77355
|
+
* }
|
|
77356
|
+
* });
|
|
77357
|
+
* console.log(results);
|
|
77358
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
77359
|
+
* }
|
|
77360
|
+
* catch (err) {
|
|
77361
|
+
* console.log(err);
|
|
77362
|
+
* }
|
|
77363
|
+
* }
|
|
77364
|
+
*
|
|
76586
77365
|
*/
|
|
76587
77366
|
function parallel$1(tasks, callback) {
|
|
76588
77367
|
return _parallel(eachOf$1, tasks, callback);
|
|
@@ -76640,7 +77419,7 @@ function parallelLimit(tasks, limit, callback) {
|
|
|
76640
77419
|
* Invoke with `queue.unshift(task, [callback])`.
|
|
76641
77420
|
* @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns
|
|
76642
77421
|
* a promise that rejects if an error occurs.
|
|
76643
|
-
* @property {AsyncFunction}
|
|
77422
|
+
* @property {AsyncFunction} unshiftAsync - the same as `q.unshift`, except this returns
|
|
76644
77423
|
* a promise that rejects if an error occurs.
|
|
76645
77424
|
* @property {Function} remove - remove items from the queue that match a test
|
|
76646
77425
|
* function. The test function will be passed an object with a `data` property,
|
|
@@ -76679,7 +77458,7 @@ function parallelLimit(tasks, limit, callback) {
|
|
|
76679
77458
|
* should be pushed to the queue after calling this function. Invoke with `queue.kill()`.
|
|
76680
77459
|
*
|
|
76681
77460
|
* @example
|
|
76682
|
-
* const q =
|
|
77461
|
+
* const q = async.queue(worker, 2)
|
|
76683
77462
|
* q.push(item1)
|
|
76684
77463
|
* q.push(item2)
|
|
76685
77464
|
* q.push(item3)
|
|
@@ -76902,6 +77681,7 @@ function smaller(x, y) {
|
|
|
76902
77681
|
function priorityQueue(worker, concurrency) {
|
|
76903
77682
|
// Start with a normal queue
|
|
76904
77683
|
var q = queue$1(worker, concurrency);
|
|
77684
|
+
var processingScheduled = false;
|
|
76905
77685
|
|
|
76906
77686
|
q._tasks = new Heap();
|
|
76907
77687
|
|
|
@@ -76929,7 +77709,13 @@ function priorityQueue(worker, concurrency) {
|
|
|
76929
77709
|
q._tasks.push(item);
|
|
76930
77710
|
}
|
|
76931
77711
|
|
|
76932
|
-
|
|
77712
|
+
if (!processingScheduled) {
|
|
77713
|
+
processingScheduled = true;
|
|
77714
|
+
setImmediate$1(() => {
|
|
77715
|
+
processingScheduled = false;
|
|
77716
|
+
q.process();
|
|
77717
|
+
});
|
|
77718
|
+
}
|
|
76933
77719
|
};
|
|
76934
77720
|
|
|
76935
77721
|
// Remove unshift function
|
|
@@ -77000,7 +77786,7 @@ var race$1$1 = awaitify(race$1, 2);
|
|
|
77000
77786
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
77001
77787
|
* array to produce the next step in the reduction.
|
|
77002
77788
|
* The `iteratee` should complete with the next state of the reduction.
|
|
77003
|
-
* If the iteratee
|
|
77789
|
+
* If the iteratee completes with an error, the reduction is stopped and the
|
|
77004
77790
|
* main `callback` is immediately called with the error.
|
|
77005
77791
|
* Invoked with (memo, item, callback).
|
|
77006
77792
|
* @param {Function} [callback] - A callback which is called after all the
|
|
@@ -77182,14 +77968,48 @@ function reject(eachfn, arr, _iteratee, callback) {
|
|
|
77182
77968
|
* @returns {Promise} a promise, if no callback is passed
|
|
77183
77969
|
* @example
|
|
77184
77970
|
*
|
|
77185
|
-
*
|
|
77186
|
-
*
|
|
77187
|
-
*
|
|
77188
|
-
*
|
|
77189
|
-
*
|
|
77190
|
-
*
|
|
77191
|
-
*
|
|
77971
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
77972
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
77973
|
+
* // dir3 is a directory that contains file5.txt
|
|
77974
|
+
*
|
|
77975
|
+
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
|
77976
|
+
*
|
|
77977
|
+
* // asynchronous function that checks if a file exists
|
|
77978
|
+
* function fileExists(file, callback) {
|
|
77979
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
77980
|
+
* callback(null, !err);
|
|
77981
|
+
* });
|
|
77982
|
+
* }
|
|
77983
|
+
*
|
|
77984
|
+
* // Using callbacks
|
|
77985
|
+
* async.reject(fileList, fileExists, function(err, results) {
|
|
77986
|
+
* // [ 'dir3/file6.txt' ]
|
|
77987
|
+
* // results now equals an array of the non-existing files
|
|
77192
77988
|
* });
|
|
77989
|
+
*
|
|
77990
|
+
* // Using Promises
|
|
77991
|
+
* async.reject(fileList, fileExists)
|
|
77992
|
+
* .then( results => {
|
|
77993
|
+
* console.log(results);
|
|
77994
|
+
* // [ 'dir3/file6.txt' ]
|
|
77995
|
+
* // results now equals an array of the non-existing files
|
|
77996
|
+
* }).catch( err => {
|
|
77997
|
+
* console.log(err);
|
|
77998
|
+
* });
|
|
77999
|
+
*
|
|
78000
|
+
* // Using async/await
|
|
78001
|
+
* async () => {
|
|
78002
|
+
* try {
|
|
78003
|
+
* let results = await async.reject(fileList, fileExists);
|
|
78004
|
+
* console.log(results);
|
|
78005
|
+
* // [ 'dir3/file6.txt' ]
|
|
78006
|
+
* // results now equals an array of the non-existing files
|
|
78007
|
+
* }
|
|
78008
|
+
* catch (err) {
|
|
78009
|
+
* console.log(err);
|
|
78010
|
+
* }
|
|
78011
|
+
* }
|
|
78012
|
+
*
|
|
77193
78013
|
*/
|
|
77194
78014
|
function reject$1 (coll, iteratee, callback) {
|
|
77195
78015
|
return reject(eachOf$1, coll, iteratee, callback)
|
|
@@ -77482,35 +78302,135 @@ function retryable (opts, task) {
|
|
|
77482
78302
|
* with (err, result).
|
|
77483
78303
|
* @return {Promise} a promise, if no callback is passed
|
|
77484
78304
|
* @example
|
|
78305
|
+
*
|
|
78306
|
+
* //Using Callbacks
|
|
77485
78307
|
* async.series([
|
|
77486
78308
|
* function(callback) {
|
|
77487
|
-
*
|
|
77488
|
-
*
|
|
78309
|
+
* setTimeout(function() {
|
|
78310
|
+
* // do some async task
|
|
78311
|
+
* callback(null, 'one');
|
|
78312
|
+
* }, 200);
|
|
77489
78313
|
* },
|
|
77490
78314
|
* function(callback) {
|
|
77491
|
-
*
|
|
77492
|
-
*
|
|
78315
|
+
* setTimeout(function() {
|
|
78316
|
+
* // then do another async task
|
|
78317
|
+
* callback(null, 'two');
|
|
78318
|
+
* }, 100);
|
|
77493
78319
|
* }
|
|
77494
|
-
* ],
|
|
77495
|
-
*
|
|
77496
|
-
*
|
|
77497
|
-
* // results is now equal to ['one', 'two']
|
|
78320
|
+
* ], function(err, results) {
|
|
78321
|
+
* console.log(results);
|
|
78322
|
+
* // results is equal to ['one','two']
|
|
77498
78323
|
* });
|
|
77499
78324
|
*
|
|
78325
|
+
* // an example using objects instead of arrays
|
|
77500
78326
|
* async.series({
|
|
77501
78327
|
* one: function(callback) {
|
|
77502
78328
|
* setTimeout(function() {
|
|
78329
|
+
* // do some async task
|
|
77503
78330
|
* callback(null, 1);
|
|
77504
78331
|
* }, 200);
|
|
77505
78332
|
* },
|
|
77506
|
-
* two: function(callback){
|
|
78333
|
+
* two: function(callback) {
|
|
77507
78334
|
* setTimeout(function() {
|
|
78335
|
+
* // then do another async task
|
|
77508
78336
|
* callback(null, 2);
|
|
77509
78337
|
* }, 100);
|
|
77510
78338
|
* }
|
|
77511
78339
|
* }, function(err, results) {
|
|
77512
|
-
*
|
|
78340
|
+
* console.log(results);
|
|
78341
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
78342
|
+
* });
|
|
78343
|
+
*
|
|
78344
|
+
* //Using Promises
|
|
78345
|
+
* async.series([
|
|
78346
|
+
* function(callback) {
|
|
78347
|
+
* setTimeout(function() {
|
|
78348
|
+
* callback(null, 'one');
|
|
78349
|
+
* }, 200);
|
|
78350
|
+
* },
|
|
78351
|
+
* function(callback) {
|
|
78352
|
+
* setTimeout(function() {
|
|
78353
|
+
* callback(null, 'two');
|
|
78354
|
+
* }, 100);
|
|
78355
|
+
* }
|
|
78356
|
+
* ]).then(results => {
|
|
78357
|
+
* console.log(results);
|
|
78358
|
+
* // results is equal to ['one','two']
|
|
78359
|
+
* }).catch(err => {
|
|
78360
|
+
* console.log(err);
|
|
78361
|
+
* });
|
|
78362
|
+
*
|
|
78363
|
+
* // an example using an object instead of an array
|
|
78364
|
+
* async.series({
|
|
78365
|
+
* one: function(callback) {
|
|
78366
|
+
* setTimeout(function() {
|
|
78367
|
+
* // do some async task
|
|
78368
|
+
* callback(null, 1);
|
|
78369
|
+
* }, 200);
|
|
78370
|
+
* },
|
|
78371
|
+
* two: function(callback) {
|
|
78372
|
+
* setTimeout(function() {
|
|
78373
|
+
* // then do another async task
|
|
78374
|
+
* callback(null, 2);
|
|
78375
|
+
* }, 100);
|
|
78376
|
+
* }
|
|
78377
|
+
* }).then(results => {
|
|
78378
|
+
* console.log(results);
|
|
78379
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
78380
|
+
* }).catch(err => {
|
|
78381
|
+
* console.log(err);
|
|
77513
78382
|
* });
|
|
78383
|
+
*
|
|
78384
|
+
* //Using async/await
|
|
78385
|
+
* async () => {
|
|
78386
|
+
* try {
|
|
78387
|
+
* let results = await async.series([
|
|
78388
|
+
* function(callback) {
|
|
78389
|
+
* setTimeout(function() {
|
|
78390
|
+
* // do some async task
|
|
78391
|
+
* callback(null, 'one');
|
|
78392
|
+
* }, 200);
|
|
78393
|
+
* },
|
|
78394
|
+
* function(callback) {
|
|
78395
|
+
* setTimeout(function() {
|
|
78396
|
+
* // then do another async task
|
|
78397
|
+
* callback(null, 'two');
|
|
78398
|
+
* }, 100);
|
|
78399
|
+
* }
|
|
78400
|
+
* ]);
|
|
78401
|
+
* console.log(results);
|
|
78402
|
+
* // results is equal to ['one','two']
|
|
78403
|
+
* }
|
|
78404
|
+
* catch (err) {
|
|
78405
|
+
* console.log(err);
|
|
78406
|
+
* }
|
|
78407
|
+
* }
|
|
78408
|
+
*
|
|
78409
|
+
* // an example using an object instead of an array
|
|
78410
|
+
* async () => {
|
|
78411
|
+
* try {
|
|
78412
|
+
* let results = await async.parallel({
|
|
78413
|
+
* one: function(callback) {
|
|
78414
|
+
* setTimeout(function() {
|
|
78415
|
+
* // do some async task
|
|
78416
|
+
* callback(null, 1);
|
|
78417
|
+
* }, 200);
|
|
78418
|
+
* },
|
|
78419
|
+
* two: function(callback) {
|
|
78420
|
+
* setTimeout(function() {
|
|
78421
|
+
* // then do another async task
|
|
78422
|
+
* callback(null, 2);
|
|
78423
|
+
* }, 100);
|
|
78424
|
+
* }
|
|
78425
|
+
* });
|
|
78426
|
+
* console.log(results);
|
|
78427
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
78428
|
+
* }
|
|
78429
|
+
* catch (err) {
|
|
78430
|
+
* console.log(err);
|
|
78431
|
+
* }
|
|
78432
|
+
* }
|
|
78433
|
+
*
|
|
77514
78434
|
*/
|
|
77515
78435
|
function series(tasks, callback) {
|
|
77516
78436
|
return _parallel(eachOfSeries$1, tasks, callback);
|
|
@@ -77539,13 +78459,79 @@ function series(tasks, callback) {
|
|
|
77539
78459
|
* @returns {Promise} a promise, if no callback provided
|
|
77540
78460
|
* @example
|
|
77541
78461
|
*
|
|
77542
|
-
*
|
|
77543
|
-
*
|
|
77544
|
-
*
|
|
77545
|
-
*
|
|
77546
|
-
*
|
|
77547
|
-
*
|
|
78462
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
78463
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
78464
|
+
* // dir3 is a directory that contains file5.txt
|
|
78465
|
+
* // dir4 does not exist
|
|
78466
|
+
*
|
|
78467
|
+
* // asynchronous function that checks if a file exists
|
|
78468
|
+
* function fileExists(file, callback) {
|
|
78469
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
78470
|
+
* callback(null, !err);
|
|
78471
|
+
* });
|
|
78472
|
+
* }
|
|
78473
|
+
*
|
|
78474
|
+
* // Using callbacks
|
|
78475
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
|
|
78476
|
+
* function(err, result) {
|
|
78477
|
+
* console.log(result);
|
|
78478
|
+
* // true
|
|
78479
|
+
* // result is true since some file in the list exists
|
|
78480
|
+
* }
|
|
78481
|
+
*);
|
|
78482
|
+
*
|
|
78483
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
|
|
78484
|
+
* function(err, result) {
|
|
78485
|
+
* console.log(result);
|
|
78486
|
+
* // false
|
|
78487
|
+
* // result is false since none of the files exists
|
|
78488
|
+
* }
|
|
78489
|
+
*);
|
|
78490
|
+
*
|
|
78491
|
+
* // Using Promises
|
|
78492
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
|
|
78493
|
+
* .then( result => {
|
|
78494
|
+
* console.log(result);
|
|
78495
|
+
* // true
|
|
78496
|
+
* // result is true since some file in the list exists
|
|
78497
|
+
* }).catch( err => {
|
|
78498
|
+
* console.log(err);
|
|
77548
78499
|
* });
|
|
78500
|
+
*
|
|
78501
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
|
|
78502
|
+
* .then( result => {
|
|
78503
|
+
* console.log(result);
|
|
78504
|
+
* // false
|
|
78505
|
+
* // result is false since none of the files exists
|
|
78506
|
+
* }).catch( err => {
|
|
78507
|
+
* console.log(err);
|
|
78508
|
+
* });
|
|
78509
|
+
*
|
|
78510
|
+
* // Using async/await
|
|
78511
|
+
* async () => {
|
|
78512
|
+
* try {
|
|
78513
|
+
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
|
|
78514
|
+
* console.log(result);
|
|
78515
|
+
* // true
|
|
78516
|
+
* // result is true since some file in the list exists
|
|
78517
|
+
* }
|
|
78518
|
+
* catch (err) {
|
|
78519
|
+
* console.log(err);
|
|
78520
|
+
* }
|
|
78521
|
+
* }
|
|
78522
|
+
*
|
|
78523
|
+
* async () => {
|
|
78524
|
+
* try {
|
|
78525
|
+
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
|
|
78526
|
+
* console.log(result);
|
|
78527
|
+
* // false
|
|
78528
|
+
* // result is false since none of the files exists
|
|
78529
|
+
* }
|
|
78530
|
+
* catch (err) {
|
|
78531
|
+
* console.log(err);
|
|
78532
|
+
* }
|
|
78533
|
+
* }
|
|
78534
|
+
*
|
|
77549
78535
|
*/
|
|
77550
78536
|
function some(coll, iteratee, callback) {
|
|
77551
78537
|
return _createTester(Boolean, res => res)(eachOf$1, coll, iteratee, callback)
|
|
@@ -77627,31 +78613,133 @@ var someSeries$1 = awaitify(someSeries, 3);
|
|
|
77627
78613
|
* @returns {Promise} a promise, if no callback passed
|
|
77628
78614
|
* @example
|
|
77629
78615
|
*
|
|
77630
|
-
*
|
|
77631
|
-
*
|
|
77632
|
-
*
|
|
78616
|
+
* // bigfile.txt is a file that is 251100 bytes in size
|
|
78617
|
+
* // mediumfile.txt is a file that is 11000 bytes in size
|
|
78618
|
+
* // smallfile.txt is a file that is 121 bytes in size
|
|
78619
|
+
*
|
|
78620
|
+
* // asynchronous function that returns the file size in bytes
|
|
78621
|
+
* function getFileSizeInBytes(file, callback) {
|
|
78622
|
+
* fs.stat(file, function(err, stat) {
|
|
78623
|
+
* if (err) {
|
|
78624
|
+
* return callback(err);
|
|
78625
|
+
* }
|
|
78626
|
+
* callback(null, stat.size);
|
|
77633
78627
|
* });
|
|
77634
|
-
* }
|
|
77635
|
-
*
|
|
77636
|
-
*
|
|
77637
|
-
*
|
|
78628
|
+
* }
|
|
78629
|
+
*
|
|
78630
|
+
* // Using callbacks
|
|
78631
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes,
|
|
78632
|
+
* function(err, results) {
|
|
78633
|
+
* if (err) {
|
|
78634
|
+
* console.log(err);
|
|
78635
|
+
* } else {
|
|
78636
|
+
* console.log(results);
|
|
78637
|
+
* // results is now the original array of files sorted by
|
|
78638
|
+
* // file size (ascending by default), e.g.
|
|
78639
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78640
|
+
* }
|
|
78641
|
+
* }
|
|
78642
|
+
* );
|
|
77638
78643
|
*
|
|
77639
78644
|
* // By modifying the callback parameter the
|
|
77640
78645
|
* // sorting order can be influenced:
|
|
77641
78646
|
*
|
|
77642
78647
|
* // ascending order
|
|
77643
|
-
* async.sortBy([
|
|
77644
|
-
*
|
|
77645
|
-
*
|
|
77646
|
-
*
|
|
77647
|
-
*
|
|
78648
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) {
|
|
78649
|
+
* getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
|
|
78650
|
+
* if (getFileSizeErr) return callback(getFileSizeErr);
|
|
78651
|
+
* callback(null, fileSize);
|
|
78652
|
+
* });
|
|
78653
|
+
* }, function(err, results) {
|
|
78654
|
+
* if (err) {
|
|
78655
|
+
* console.log(err);
|
|
78656
|
+
* } else {
|
|
78657
|
+
* console.log(results);
|
|
78658
|
+
* // results is now the original array of files sorted by
|
|
78659
|
+
* // file size (ascending by default), e.g.
|
|
78660
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78661
|
+
* }
|
|
78662
|
+
* }
|
|
78663
|
+
* );
|
|
77648
78664
|
*
|
|
77649
78665
|
* // descending order
|
|
77650
|
-
* async.sortBy([
|
|
77651
|
-
*
|
|
77652
|
-
*
|
|
77653
|
-
*
|
|
78666
|
+
* async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) {
|
|
78667
|
+
* getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
|
|
78668
|
+
* if (getFileSizeErr) {
|
|
78669
|
+
* return callback(getFileSizeErr);
|
|
78670
|
+
* }
|
|
78671
|
+
* callback(null, fileSize * -1);
|
|
78672
|
+
* });
|
|
78673
|
+
* }, function(err, results) {
|
|
78674
|
+
* if (err) {
|
|
78675
|
+
* console.log(err);
|
|
78676
|
+
* } else {
|
|
78677
|
+
* console.log(results);
|
|
78678
|
+
* // results is now the original array of files sorted by
|
|
78679
|
+
* // file size (ascending by default), e.g.
|
|
78680
|
+
* // [ 'bigfile.txt', 'mediumfile.txt', 'smallfile.txt']
|
|
78681
|
+
* }
|
|
78682
|
+
* }
|
|
78683
|
+
* );
|
|
78684
|
+
*
|
|
78685
|
+
* // Error handling
|
|
78686
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes,
|
|
78687
|
+
* function(err, results) {
|
|
78688
|
+
* if (err) {
|
|
78689
|
+
* console.log(err);
|
|
78690
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
78691
|
+
* } else {
|
|
78692
|
+
* console.log(results);
|
|
78693
|
+
* }
|
|
78694
|
+
* }
|
|
78695
|
+
* );
|
|
78696
|
+
*
|
|
78697
|
+
* // Using Promises
|
|
78698
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes)
|
|
78699
|
+
* .then( results => {
|
|
78700
|
+
* console.log(results);
|
|
78701
|
+
* // results is now the original array of files sorted by
|
|
78702
|
+
* // file size (ascending by default), e.g.
|
|
78703
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78704
|
+
* }).catch( err => {
|
|
78705
|
+
* console.log(err);
|
|
77654
78706
|
* });
|
|
78707
|
+
*
|
|
78708
|
+
* // Error handling
|
|
78709
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes)
|
|
78710
|
+
* .then( results => {
|
|
78711
|
+
* console.log(results);
|
|
78712
|
+
* }).catch( err => {
|
|
78713
|
+
* console.log(err);
|
|
78714
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
78715
|
+
* });
|
|
78716
|
+
*
|
|
78717
|
+
* // Using async/await
|
|
78718
|
+
* (async () => {
|
|
78719
|
+
* try {
|
|
78720
|
+
* let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
|
|
78721
|
+
* console.log(results);
|
|
78722
|
+
* // results is now the original array of files sorted by
|
|
78723
|
+
* // file size (ascending by default), e.g.
|
|
78724
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78725
|
+
* }
|
|
78726
|
+
* catch (err) {
|
|
78727
|
+
* console.log(err);
|
|
78728
|
+
* }
|
|
78729
|
+
* })();
|
|
78730
|
+
*
|
|
78731
|
+
* // Error handling
|
|
78732
|
+
* async () => {
|
|
78733
|
+
* try {
|
|
78734
|
+
* let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
|
|
78735
|
+
* console.log(results);
|
|
78736
|
+
* }
|
|
78737
|
+
* catch (err) {
|
|
78738
|
+
* console.log(err);
|
|
78739
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
78740
|
+
* }
|
|
78741
|
+
* }
|
|
78742
|
+
*
|
|
77655
78743
|
*/
|
|
77656
78744
|
function sortBy$1 (coll, iteratee, callback) {
|
|
77657
78745
|
var _iteratee = wrapAsync(iteratee);
|
|
@@ -77852,26 +78940,118 @@ function timesSeries (n, iteratee, callback) {
|
|
|
77852
78940
|
* @returns {Promise} a promise, if no callback provided
|
|
77853
78941
|
* @example
|
|
77854
78942
|
*
|
|
77855
|
-
*
|
|
77856
|
-
*
|
|
77857
|
-
*
|
|
77858
|
-
*
|
|
77859
|
-
*
|
|
78943
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
78944
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
78945
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
78946
|
+
*
|
|
78947
|
+
* // helper function that returns human-readable size format from bytes
|
|
78948
|
+
* function formatBytes(bytes, decimals = 2) {
|
|
78949
|
+
* // implementation not included for brevity
|
|
78950
|
+
* return humanReadbleFilesize;
|
|
78951
|
+
* }
|
|
78952
|
+
*
|
|
78953
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
78954
|
+
*
|
|
78955
|
+
* // asynchronous function that returns the file size, transformed to human-readable format
|
|
78956
|
+
* // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
|
|
78957
|
+
* function transformFileSize(acc, value, key, callback) {
|
|
78958
|
+
* fs.stat(value, function(err, stat) {
|
|
78959
|
+
* if (err) {
|
|
78960
|
+
* return callback(err);
|
|
78961
|
+
* }
|
|
78962
|
+
* acc[key] = formatBytes(stat.size);
|
|
78963
|
+
* callback(null);
|
|
77860
78964
|
* });
|
|
77861
|
-
* }
|
|
77862
|
-
*
|
|
78965
|
+
* }
|
|
78966
|
+
*
|
|
78967
|
+
* // Using callbacks
|
|
78968
|
+
* async.transform(fileList, transformFileSize, function(err, result) {
|
|
78969
|
+
* if(err) {
|
|
78970
|
+
* console.log(err);
|
|
78971
|
+
* } else {
|
|
78972
|
+
* console.log(result);
|
|
78973
|
+
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
78974
|
+
* }
|
|
78975
|
+
* });
|
|
78976
|
+
*
|
|
78977
|
+
* // Using Promises
|
|
78978
|
+
* async.transform(fileList, transformFileSize)
|
|
78979
|
+
* .then(result => {
|
|
78980
|
+
* console.log(result);
|
|
78981
|
+
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
78982
|
+
* }).catch(err => {
|
|
78983
|
+
* console.log(err);
|
|
77863
78984
|
* });
|
|
77864
78985
|
*
|
|
78986
|
+
* // Using async/await
|
|
78987
|
+
* (async () => {
|
|
78988
|
+
* try {
|
|
78989
|
+
* let result = await async.transform(fileList, transformFileSize);
|
|
78990
|
+
* console.log(result);
|
|
78991
|
+
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
78992
|
+
* }
|
|
78993
|
+
* catch (err) {
|
|
78994
|
+
* console.log(err);
|
|
78995
|
+
* }
|
|
78996
|
+
* })();
|
|
78997
|
+
*
|
|
77865
78998
|
* @example
|
|
77866
78999
|
*
|
|
77867
|
-
*
|
|
77868
|
-
*
|
|
77869
|
-
*
|
|
77870
|
-
*
|
|
77871
|
-
*
|
|
77872
|
-
*
|
|
77873
|
-
*
|
|
77874
|
-
*
|
|
79000
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
79001
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
79002
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
79003
|
+
*
|
|
79004
|
+
* // helper function that returns human-readable size format from bytes
|
|
79005
|
+
* function formatBytes(bytes, decimals = 2) {
|
|
79006
|
+
* // implementation not included for brevity
|
|
79007
|
+
* return humanReadbleFilesize;
|
|
79008
|
+
* }
|
|
79009
|
+
*
|
|
79010
|
+
* const fileMap = { f1: 'file1.txt', f2: 'file2.txt', f3: 'file3.txt' };
|
|
79011
|
+
*
|
|
79012
|
+
* // asynchronous function that returns the file size, transformed to human-readable format
|
|
79013
|
+
* // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
|
|
79014
|
+
* function transformFileSize(acc, value, key, callback) {
|
|
79015
|
+
* fs.stat(value, function(err, stat) {
|
|
79016
|
+
* if (err) {
|
|
79017
|
+
* return callback(err);
|
|
79018
|
+
* }
|
|
79019
|
+
* acc[key] = formatBytes(stat.size);
|
|
79020
|
+
* callback(null);
|
|
79021
|
+
* });
|
|
79022
|
+
* }
|
|
79023
|
+
*
|
|
79024
|
+
* // Using callbacks
|
|
79025
|
+
* async.transform(fileMap, transformFileSize, function(err, result) {
|
|
79026
|
+
* if(err) {
|
|
79027
|
+
* console.log(err);
|
|
79028
|
+
* } else {
|
|
79029
|
+
* console.log(result);
|
|
79030
|
+
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
79031
|
+
* }
|
|
79032
|
+
* });
|
|
79033
|
+
*
|
|
79034
|
+
* // Using Promises
|
|
79035
|
+
* async.transform(fileMap, transformFileSize)
|
|
79036
|
+
* .then(result => {
|
|
79037
|
+
* console.log(result);
|
|
79038
|
+
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
79039
|
+
* }).catch(err => {
|
|
79040
|
+
* console.log(err);
|
|
79041
|
+
* });
|
|
79042
|
+
*
|
|
79043
|
+
* // Using async/await
|
|
79044
|
+
* async () => {
|
|
79045
|
+
* try {
|
|
79046
|
+
* let result = await async.transform(fileMap, transformFileSize);
|
|
79047
|
+
* console.log(result);
|
|
79048
|
+
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
79049
|
+
* }
|
|
79050
|
+
* catch (err) {
|
|
79051
|
+
* console.log(err);
|
|
79052
|
+
* }
|
|
79053
|
+
* }
|
|
79054
|
+
*
|
|
77875
79055
|
*/
|
|
77876
79056
|
function transform (coll, accumulator, iteratee, callback) {
|
|
77877
79057
|
if (arguments.length <= 3 && typeof accumulator === 'function') {
|
|
@@ -78049,7 +79229,7 @@ var whilst$1 = awaitify(whilst, 3);
|
|
|
78049
79229
|
* @example
|
|
78050
79230
|
* const results = []
|
|
78051
79231
|
* let finished = false
|
|
78052
|
-
* async.until(function test(
|
|
79232
|
+
* async.until(function test(cb) {
|
|
78053
79233
|
* cb(null, finished)
|
|
78054
79234
|
* }, function iter(next) {
|
|
78055
79235
|
* fetchPage(url, (err, body) => {
|
|
@@ -92439,9 +93619,16 @@ ZipArchiveEntry.prototype.setMethod = function(method) {
|
|
|
92439
93619
|
* Sets the name of the entry.
|
|
92440
93620
|
*
|
|
92441
93621
|
* @param name
|
|
93622
|
+
* @param prependSlash
|
|
92442
93623
|
*/
|
|
92443
|
-
ZipArchiveEntry.prototype.setName = function(name) {
|
|
92444
|
-
name = normalizePath(name, false)
|
|
93624
|
+
ZipArchiveEntry.prototype.setName = function(name, prependSlash = false) {
|
|
93625
|
+
name = normalizePath(name, false)
|
|
93626
|
+
.replace(/^\w+:/, '')
|
|
93627
|
+
.replace(/^(\.\.\/|\/)+/, '');
|
|
93628
|
+
|
|
93629
|
+
if (prependSlash) {
|
|
93630
|
+
name = `/${name}`;
|
|
93631
|
+
}
|
|
92445
93632
|
|
|
92446
93633
|
if (Buffer.byteLength(name) !== name.length) {
|
|
92447
93634
|
this.getGeneralPurposeBit().useUTF8ForNames(true);
|
|
@@ -98945,13 +100132,13 @@ class DeflateCRC32Stream extends DeflateRaw {
|
|
|
98945
100132
|
return super.push(chunk, encoding);
|
|
98946
100133
|
}
|
|
98947
100134
|
|
|
98948
|
-
|
|
100135
|
+
_transform(chunk, encoding, callback) {
|
|
98949
100136
|
if (chunk) {
|
|
98950
100137
|
this.checksum = crc32$1.buf(chunk, this.checksum) >>> 0;
|
|
98951
100138
|
this.rawSize += chunk.length;
|
|
98952
100139
|
}
|
|
98953
100140
|
|
|
98954
|
-
|
|
100141
|
+
super._transform(chunk, encoding, callback);
|
|
98955
100142
|
}
|
|
98956
100143
|
|
|
98957
100144
|
digest(encoding) {
|
|
@@ -99493,6 +100680,8 @@ var ZipStream = module.exports = function(options) {
|
|
|
99493
100680
|
options.store = true;
|
|
99494
100681
|
}
|
|
99495
100682
|
|
|
100683
|
+
options.namePrependSlash = options.namePrependSlash || false;
|
|
100684
|
+
|
|
99496
100685
|
if (options.comment && options.comment.length > 0) {
|
|
99497
100686
|
this.setComment(options.comment);
|
|
99498
100687
|
}
|
|
@@ -99511,6 +100700,7 @@ ZipStream.prototype._normalizeFileData = function(data) {
|
|
|
99511
100700
|
data = archiverUtils.defaults(data, {
|
|
99512
100701
|
type: 'file',
|
|
99513
100702
|
name: null,
|
|
100703
|
+
namePrependSlash: this.options.namePrependSlash,
|
|
99514
100704
|
linkname: null,
|
|
99515
100705
|
date: null,
|
|
99516
100706
|
mode: null,
|
|
@@ -99581,6 +100771,10 @@ ZipStream.prototype.entry = function(source, data, callback) {
|
|
|
99581
100771
|
var entry = new ZipArchiveEntry(data.name);
|
|
99582
100772
|
entry.setTime(data.date, this.options.forceLocalTime);
|
|
99583
100773
|
|
|
100774
|
+
if (data.namePrependSlash) {
|
|
100775
|
+
entry.setName(data.name, true);
|
|
100776
|
+
}
|
|
100777
|
+
|
|
99584
100778
|
if (data.store) {
|
|
99585
100779
|
entry.setMethod(0);
|
|
99586
100780
|
}
|
|
@@ -99645,6 +100839,7 @@ ZipStream.prototype.finalize = function() {
|
|
|
99645
100839
|
* @param {String} [options.comment] Sets the zip archive comment.
|
|
99646
100840
|
* @param {Boolean} [options.forceLocalTime=false] Forces the archive to contain local file times instead of UTC.
|
|
99647
100841
|
* @param {Boolean} [options.forceZip64=false] Forces the archive to contain ZIP64 headers.
|
|
100842
|
+
* @param {Boolean} [options.namePrependSlash=false] Prepends a forward slash to archive file paths.
|
|
99648
100843
|
* @param {Boolean} [options.store=false] Sets the compression method to STORE.
|
|
99649
100844
|
* @param {Object} [options.zlib] Passed to [zlib]{@link https://nodejs.org/api/zlib.html#zlib_class_options}
|
|
99650
100845
|
*/
|
|
@@ -99656,6 +100851,7 @@ var Zip = function(options) {
|
|
|
99656
100851
|
options = this.options = archiverUtils.defaults(options, {
|
|
99657
100852
|
comment: '',
|
|
99658
100853
|
forceUTC: false,
|
|
100854
|
+
namePrependSlash: false,
|
|
99659
100855
|
store: false
|
|
99660
100856
|
});
|
|
99661
100857
|
|
|
@@ -103062,7 +104258,7 @@ BufferList$1.prototype._match = function (offset, search) {
|
|
|
103062
104258
|
return this.slice(offset, offset + byteLength)[m](0, byteLength)
|
|
103063
104259
|
};
|
|
103064
104260
|
} else {
|
|
103065
|
-
BufferList$1.prototype[m] = function (offset) {
|
|
104261
|
+
BufferList$1.prototype[m] = function (offset = 0) {
|
|
103066
104262
|
return this.slice(offset, offset + methods[m])[m](0)
|
|
103067
104263
|
};
|
|
103068
104264
|
}
|