@ikas/storefront 0.1.8 → 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 +2 -2
package/build/index.es.js
CHANGED
|
@@ -73629,6 +73629,7 @@ function initialParams (fn) {
|
|
|
73629
73629
|
|
|
73630
73630
|
/* istanbul ignore file */
|
|
73631
73631
|
|
|
73632
|
+
var hasQueueMicrotask = typeof queueMicrotask === 'function' && queueMicrotask;
|
|
73632
73633
|
var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
|
|
73633
73634
|
var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
|
|
73634
73635
|
|
|
@@ -73642,7 +73643,9 @@ function wrap$2(defer) {
|
|
|
73642
73643
|
|
|
73643
73644
|
var _defer;
|
|
73644
73645
|
|
|
73645
|
-
if (
|
|
73646
|
+
if (hasQueueMicrotask) {
|
|
73647
|
+
_defer = queueMicrotask;
|
|
73648
|
+
} else if (hasSetImmediate) {
|
|
73646
73649
|
_defer = setImmediate;
|
|
73647
73650
|
} else if (hasNextTick) {
|
|
73648
73651
|
_defer = process.nextTick;
|
|
@@ -74094,12 +74097,19 @@ function eachOfGeneric (coll, iteratee, callback) {
|
|
|
74094
74097
|
* @returns {Promise} a promise, if a callback is omitted
|
|
74095
74098
|
* @example
|
|
74096
74099
|
*
|
|
74097
|
-
*
|
|
74098
|
-
*
|
|
74100
|
+
* // dev.json is a file containing a valid json object config for dev environment
|
|
74101
|
+
* // dev.json is a file containing a valid json object config for test environment
|
|
74102
|
+
* // prod.json is a file containing a valid json object config for prod environment
|
|
74103
|
+
* // invalid.json is a file with a malformed json object
|
|
74099
74104
|
*
|
|
74100
|
-
*
|
|
74101
|
-
*
|
|
74102
|
-
*
|
|
74105
|
+
* let configs = {}; //global variable
|
|
74106
|
+
* let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
|
|
74107
|
+
* let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
|
|
74108
|
+
*
|
|
74109
|
+
* // asynchronous function that reads a json file and parses the contents as json object
|
|
74110
|
+
* function parseFile(file, key, callback) {
|
|
74111
|
+
* fs.readFile(file, "utf8", function(err, data) {
|
|
74112
|
+
* if (err) return calback(err);
|
|
74103
74113
|
* try {
|
|
74104
74114
|
* configs[key] = JSON.parse(data);
|
|
74105
74115
|
* } catch (e) {
|
|
@@ -74107,11 +74117,73 @@ function eachOfGeneric (coll, iteratee, callback) {
|
|
|
74107
74117
|
* }
|
|
74108
74118
|
* callback();
|
|
74109
74119
|
* });
|
|
74110
|
-
* }
|
|
74111
|
-
*
|
|
74112
|
-
*
|
|
74113
|
-
*
|
|
74120
|
+
* }
|
|
74121
|
+
*
|
|
74122
|
+
* // Using callbacks
|
|
74123
|
+
* async.forEachOf(validConfigFileMap, parseFile, function (err) {
|
|
74124
|
+
* if (err) {
|
|
74125
|
+
* console.error(err);
|
|
74126
|
+
* } else {
|
|
74127
|
+
* console.log(configs);
|
|
74128
|
+
* // configs is now a map of JSON data, e.g.
|
|
74129
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
74130
|
+
* }
|
|
74131
|
+
* });
|
|
74132
|
+
*
|
|
74133
|
+
* //Error handing
|
|
74134
|
+
* async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
|
|
74135
|
+
* if (err) {
|
|
74136
|
+
* console.error(err);
|
|
74137
|
+
* // JSON parse error exception
|
|
74138
|
+
* } else {
|
|
74139
|
+
* console.log(configs);
|
|
74140
|
+
* }
|
|
74141
|
+
* });
|
|
74142
|
+
*
|
|
74143
|
+
* // Using Promises
|
|
74144
|
+
* async.forEachOf(validConfigFileMap, parseFile)
|
|
74145
|
+
* .then( () => {
|
|
74146
|
+
* console.log(configs);
|
|
74147
|
+
* // configs is now a map of JSON data, e.g.
|
|
74148
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
74149
|
+
* }).catch( err => {
|
|
74150
|
+
* console.error(err);
|
|
74151
|
+
* });
|
|
74152
|
+
*
|
|
74153
|
+
* //Error handing
|
|
74154
|
+
* async.forEachOf(invalidConfigFileMap, parseFile)
|
|
74155
|
+
* .then( () => {
|
|
74156
|
+
* console.log(configs);
|
|
74157
|
+
* }).catch( err => {
|
|
74158
|
+
* console.error(err);
|
|
74159
|
+
* // JSON parse error exception
|
|
74114
74160
|
* });
|
|
74161
|
+
*
|
|
74162
|
+
* // Using async/await
|
|
74163
|
+
* async () => {
|
|
74164
|
+
* try {
|
|
74165
|
+
* let result = await async.forEachOf(validConfigFileMap, parseFile);
|
|
74166
|
+
* console.log(configs);
|
|
74167
|
+
* // configs is now a map of JSON data, e.g.
|
|
74168
|
+
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
|
74169
|
+
* }
|
|
74170
|
+
* catch (err) {
|
|
74171
|
+
* console.log(err);
|
|
74172
|
+
* }
|
|
74173
|
+
* }
|
|
74174
|
+
*
|
|
74175
|
+
* //Error handing
|
|
74176
|
+
* async () => {
|
|
74177
|
+
* try {
|
|
74178
|
+
* let result = await async.forEachOf(invalidConfigFileMap, parseFile);
|
|
74179
|
+
* console.log(configs);
|
|
74180
|
+
* }
|
|
74181
|
+
* catch (err) {
|
|
74182
|
+
* console.log(err);
|
|
74183
|
+
* // JSON parse error exception
|
|
74184
|
+
* }
|
|
74185
|
+
* }
|
|
74186
|
+
*
|
|
74115
74187
|
*/
|
|
74116
74188
|
function eachOf(coll, iteratee, callback) {
|
|
74117
74189
|
var eachOfImplementation = isArrayLike$1(coll) ? eachOfArrayLike : eachOfGeneric;
|
|
@@ -74153,9 +74225,89 @@ var eachOf$1 = awaitify(eachOf, 3);
|
|
|
74153
74225
|
* @returns {Promise} a promise, if no callback is passed
|
|
74154
74226
|
* @example
|
|
74155
74227
|
*
|
|
74156
|
-
*
|
|
74157
|
-
*
|
|
74228
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
74229
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
74230
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
74231
|
+
* // file4.txt does not exist
|
|
74232
|
+
*
|
|
74233
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
74234
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
74235
|
+
*
|
|
74236
|
+
* // asynchronous function that returns the file size in bytes
|
|
74237
|
+
* function getFileSizeInBytes(file, callback) {
|
|
74238
|
+
* fs.stat(file, function(err, stat) {
|
|
74239
|
+
* if (err) {
|
|
74240
|
+
* return callback(err);
|
|
74241
|
+
* }
|
|
74242
|
+
* callback(null, stat.size);
|
|
74243
|
+
* });
|
|
74244
|
+
* }
|
|
74245
|
+
*
|
|
74246
|
+
* // Using callbacks
|
|
74247
|
+
* async.map(fileList, getFileSizeInBytes, function(err, results) {
|
|
74248
|
+
* if (err) {
|
|
74249
|
+
* console.log(err);
|
|
74250
|
+
* } else {
|
|
74251
|
+
* console.log(results);
|
|
74252
|
+
* // results is now an array of the file size in bytes for each file, e.g.
|
|
74253
|
+
* // [ 1000, 2000, 3000]
|
|
74254
|
+
* }
|
|
74255
|
+
* });
|
|
74256
|
+
*
|
|
74257
|
+
* // Error Handling
|
|
74258
|
+
* async.map(withMissingFileList, getFileSizeInBytes, function(err, results) {
|
|
74259
|
+
* if (err) {
|
|
74260
|
+
* console.log(err);
|
|
74261
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
74262
|
+
* } else {
|
|
74263
|
+
* console.log(results);
|
|
74264
|
+
* }
|
|
74265
|
+
* });
|
|
74266
|
+
*
|
|
74267
|
+
* // Using Promises
|
|
74268
|
+
* async.map(fileList, getFileSizeInBytes)
|
|
74269
|
+
* .then( results => {
|
|
74270
|
+
* console.log(results);
|
|
74271
|
+
* // results is now an array of the file size in bytes for each file, e.g.
|
|
74272
|
+
* // [ 1000, 2000, 3000]
|
|
74273
|
+
* }).catch( err => {
|
|
74274
|
+
* console.log(err);
|
|
74158
74275
|
* });
|
|
74276
|
+
*
|
|
74277
|
+
* // Error Handling
|
|
74278
|
+
* async.map(withMissingFileList, getFileSizeInBytes)
|
|
74279
|
+
* .then( results => {
|
|
74280
|
+
* console.log(results);
|
|
74281
|
+
* }).catch( err => {
|
|
74282
|
+
* console.log(err);
|
|
74283
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
74284
|
+
* });
|
|
74285
|
+
*
|
|
74286
|
+
* // Using async/await
|
|
74287
|
+
* async () => {
|
|
74288
|
+
* try {
|
|
74289
|
+
* let results = await async.map(fileList, getFileSizeInBytes);
|
|
74290
|
+
* console.log(results);
|
|
74291
|
+
* // results is now an array of the file size in bytes for each file, e.g.
|
|
74292
|
+
* // [ 1000, 2000, 3000]
|
|
74293
|
+
* }
|
|
74294
|
+
* catch (err) {
|
|
74295
|
+
* console.log(err);
|
|
74296
|
+
* }
|
|
74297
|
+
* }
|
|
74298
|
+
*
|
|
74299
|
+
* // Error Handling
|
|
74300
|
+
* async () => {
|
|
74301
|
+
* try {
|
|
74302
|
+
* let results = await async.map(withMissingFileList, getFileSizeInBytes);
|
|
74303
|
+
* console.log(results);
|
|
74304
|
+
* }
|
|
74305
|
+
* catch (err) {
|
|
74306
|
+
* console.log(err);
|
|
74307
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
74308
|
+
* }
|
|
74309
|
+
* }
|
|
74310
|
+
*
|
|
74159
74311
|
*/
|
|
74160
74312
|
function map$1 (coll, iteratee, callback) {
|
|
74161
74313
|
return _asyncMap(eachOf$1, coll, iteratee, callback)
|
|
@@ -74329,15 +74481,40 @@ function promiseCallback () {
|
|
|
74329
74481
|
* @returns {Promise} a promise, if a callback is not passed
|
|
74330
74482
|
* @example
|
|
74331
74483
|
*
|
|
74484
|
+
* //Using Callbacks
|
|
74332
74485
|
* async.auto({
|
|
74333
|
-
*
|
|
74334
|
-
*
|
|
74335
|
-
*
|
|
74336
|
-
*
|
|
74337
|
-
*
|
|
74486
|
+
* get_data: function(callback) {
|
|
74487
|
+
* // async code to get some data
|
|
74488
|
+
* callback(null, 'data', 'converted to array');
|
|
74489
|
+
* },
|
|
74490
|
+
* make_folder: function(callback) {
|
|
74491
|
+
* // async code to create a directory to store a file in
|
|
74492
|
+
* // this is run at the same time as getting the data
|
|
74493
|
+
* callback(null, 'folder');
|
|
74494
|
+
* },
|
|
74495
|
+
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
74496
|
+
* // once there is some data and the directory exists,
|
|
74497
|
+
* // write the data to a file in the directory
|
|
74498
|
+
* callback(null, 'filename');
|
|
74499
|
+
* }],
|
|
74500
|
+
* email_link: ['write_file', function(results, callback) {
|
|
74501
|
+
* // once the file is written let's email a link to it...
|
|
74502
|
+
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
74338
74503
|
* }]
|
|
74339
|
-
* },
|
|
74504
|
+
* }, function(err, results) {
|
|
74505
|
+
* if (err) {
|
|
74506
|
+
* console.log('err = ', err);
|
|
74507
|
+
* }
|
|
74508
|
+
* console.log('results = ', results);
|
|
74509
|
+
* // results = {
|
|
74510
|
+
* // get_data: ['data', 'converted to array']
|
|
74511
|
+
* // make_folder; 'folder',
|
|
74512
|
+
* // write_file: 'filename'
|
|
74513
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
74514
|
+
* // }
|
|
74515
|
+
* });
|
|
74340
74516
|
*
|
|
74517
|
+
* //Using Promises
|
|
74341
74518
|
* async.auto({
|
|
74342
74519
|
* get_data: function(callback) {
|
|
74343
74520
|
* console.log('in get_data');
|
|
@@ -74351,21 +74528,62 @@ function promiseCallback () {
|
|
|
74351
74528
|
* callback(null, 'folder');
|
|
74352
74529
|
* },
|
|
74353
74530
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
74354
|
-
* console.log('in write_file', JSON.stringify(results));
|
|
74355
74531
|
* // once there is some data and the directory exists,
|
|
74356
74532
|
* // write the data to a file in the directory
|
|
74357
74533
|
* callback(null, 'filename');
|
|
74358
74534
|
* }],
|
|
74359
74535
|
* email_link: ['write_file', function(results, callback) {
|
|
74360
|
-
* console.log('in email_link', JSON.stringify(results));
|
|
74361
74536
|
* // once the file is written let's email a link to it...
|
|
74362
|
-
* // results.write_file contains the filename returned by write_file.
|
|
74363
74537
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
74364
74538
|
* }]
|
|
74365
|
-
* }
|
|
74366
|
-
* console.log('err = ', err);
|
|
74539
|
+
* }).then(results => {
|
|
74367
74540
|
* console.log('results = ', results);
|
|
74541
|
+
* // results = {
|
|
74542
|
+
* // get_data: ['data', 'converted to array']
|
|
74543
|
+
* // make_folder; 'folder',
|
|
74544
|
+
* // write_file: 'filename'
|
|
74545
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
74546
|
+
* // }
|
|
74547
|
+
* }).catch(err => {
|
|
74548
|
+
* console.log('err = ', err);
|
|
74368
74549
|
* });
|
|
74550
|
+
*
|
|
74551
|
+
* //Using async/await
|
|
74552
|
+
* async () => {
|
|
74553
|
+
* try {
|
|
74554
|
+
* let results = await async.auto({
|
|
74555
|
+
* get_data: function(callback) {
|
|
74556
|
+
* // async code to get some data
|
|
74557
|
+
* callback(null, 'data', 'converted to array');
|
|
74558
|
+
* },
|
|
74559
|
+
* make_folder: function(callback) {
|
|
74560
|
+
* // async code to create a directory to store a file in
|
|
74561
|
+
* // this is run at the same time as getting the data
|
|
74562
|
+
* callback(null, 'folder');
|
|
74563
|
+
* },
|
|
74564
|
+
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
|
74565
|
+
* // once there is some data and the directory exists,
|
|
74566
|
+
* // write the data to a file in the directory
|
|
74567
|
+
* callback(null, 'filename');
|
|
74568
|
+
* }],
|
|
74569
|
+
* email_link: ['write_file', function(results, callback) {
|
|
74570
|
+
* // once the file is written let's email a link to it...
|
|
74571
|
+
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
|
74572
|
+
* }]
|
|
74573
|
+
* });
|
|
74574
|
+
* console.log('results = ', results);
|
|
74575
|
+
* // results = {
|
|
74576
|
+
* // get_data: ['data', 'converted to array']
|
|
74577
|
+
* // make_folder; 'folder',
|
|
74578
|
+
* // write_file: 'filename'
|
|
74579
|
+
* // email_link: { file: 'filename', email: 'user@example.com' }
|
|
74580
|
+
* // }
|
|
74581
|
+
* }
|
|
74582
|
+
* catch (err) {
|
|
74583
|
+
* console.log(err);
|
|
74584
|
+
* }
|
|
74585
|
+
* }
|
|
74586
|
+
*
|
|
74369
74587
|
*/
|
|
74370
74588
|
function auto(tasks, concurrency, callback) {
|
|
74371
74589
|
if (typeof concurrency !== 'number') {
|
|
@@ -75173,7 +75391,7 @@ function cargo$1(worker, concurrency, payload) {
|
|
|
75173
75391
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
75174
75392
|
* array to produce the next step in the reduction.
|
|
75175
75393
|
* The `iteratee` should complete with the next state of the reduction.
|
|
75176
|
-
* If the iteratee
|
|
75394
|
+
* If the iteratee completes with an error, the reduction is stopped and the
|
|
75177
75395
|
* main `callback` is immediately called with the error.
|
|
75178
75396
|
* Invoked with (memo, item, callback).
|
|
75179
75397
|
* @param {Function} [callback] - A callback which is called after all the
|
|
@@ -75182,14 +75400,90 @@ function cargo$1(worker, concurrency, payload) {
|
|
|
75182
75400
|
* @returns {Promise} a promise, if no callback is passed
|
|
75183
75401
|
* @example
|
|
75184
75402
|
*
|
|
75185
|
-
*
|
|
75186
|
-
*
|
|
75187
|
-
*
|
|
75188
|
-
*
|
|
75403
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
75404
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
75405
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
75406
|
+
* // file4.txt does not exist
|
|
75407
|
+
*
|
|
75408
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
75409
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt'];
|
|
75410
|
+
*
|
|
75411
|
+
* // asynchronous function that computes the file size in bytes
|
|
75412
|
+
* // file size is added to the memoized value, then returned
|
|
75413
|
+
* function getFileSizeInBytes(memo, file, callback) {
|
|
75414
|
+
* fs.stat(file, function(err, stat) {
|
|
75415
|
+
* if (err) {
|
|
75416
|
+
* return callback(err);
|
|
75417
|
+
* }
|
|
75418
|
+
* callback(null, memo + stat.size);
|
|
75189
75419
|
* });
|
|
75190
|
-
* }
|
|
75191
|
-
*
|
|
75420
|
+
* }
|
|
75421
|
+
*
|
|
75422
|
+
* // Using callbacks
|
|
75423
|
+
* async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
|
|
75424
|
+
* if (err) {
|
|
75425
|
+
* console.log(err);
|
|
75426
|
+
* } else {
|
|
75427
|
+
* console.log(result);
|
|
75428
|
+
* // 6000
|
|
75429
|
+
* // which is the sum of the file sizes of the three files
|
|
75430
|
+
* }
|
|
75431
|
+
* });
|
|
75432
|
+
*
|
|
75433
|
+
* // Error Handling
|
|
75434
|
+
* async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
|
|
75435
|
+
* if (err) {
|
|
75436
|
+
* console.log(err);
|
|
75437
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75438
|
+
* } else {
|
|
75439
|
+
* console.log(result);
|
|
75440
|
+
* }
|
|
75441
|
+
* });
|
|
75442
|
+
*
|
|
75443
|
+
* // Using Promises
|
|
75444
|
+
* async.reduce(fileList, 0, getFileSizeInBytes)
|
|
75445
|
+
* .then( result => {
|
|
75446
|
+
* console.log(result);
|
|
75447
|
+
* // 6000
|
|
75448
|
+
* // which is the sum of the file sizes of the three files
|
|
75449
|
+
* }).catch( err => {
|
|
75450
|
+
* console.log(err);
|
|
75192
75451
|
* });
|
|
75452
|
+
*
|
|
75453
|
+
* // Error Handling
|
|
75454
|
+
* async.reduce(withMissingFileList, 0, getFileSizeInBytes)
|
|
75455
|
+
* .then( result => {
|
|
75456
|
+
* console.log(result);
|
|
75457
|
+
* }).catch( err => {
|
|
75458
|
+
* console.log(err);
|
|
75459
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75460
|
+
* });
|
|
75461
|
+
*
|
|
75462
|
+
* // Using async/await
|
|
75463
|
+
* async () => {
|
|
75464
|
+
* try {
|
|
75465
|
+
* let result = await async.reduce(fileList, 0, getFileSizeInBytes);
|
|
75466
|
+
* console.log(result);
|
|
75467
|
+
* // 6000
|
|
75468
|
+
* // which is the sum of the file sizes of the three files
|
|
75469
|
+
* }
|
|
75470
|
+
* catch (err) {
|
|
75471
|
+
* console.log(err);
|
|
75472
|
+
* }
|
|
75473
|
+
* }
|
|
75474
|
+
*
|
|
75475
|
+
* // Error Handling
|
|
75476
|
+
* async () => {
|
|
75477
|
+
* try {
|
|
75478
|
+
* let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
|
|
75479
|
+
* console.log(result);
|
|
75480
|
+
* }
|
|
75481
|
+
* catch (err) {
|
|
75482
|
+
* console.log(err);
|
|
75483
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75484
|
+
* }
|
|
75485
|
+
* }
|
|
75486
|
+
*
|
|
75193
75487
|
*/
|
|
75194
75488
|
function reduce(coll, memo, iteratee, callback) {
|
|
75195
75489
|
callback = once(callback);
|
|
@@ -75393,9 +75687,77 @@ var concatLimit$1 = awaitify(concatLimit, 4);
|
|
|
75393
75687
|
* @returns A Promise, if no callback is passed
|
|
75394
75688
|
* @example
|
|
75395
75689
|
*
|
|
75396
|
-
*
|
|
75397
|
-
*
|
|
75690
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
75691
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
75692
|
+
* // dir3 is a directory that contains file5.txt
|
|
75693
|
+
* // dir4 does not exist
|
|
75694
|
+
*
|
|
75695
|
+
* let directoryList = ['dir1','dir2','dir3'];
|
|
75696
|
+
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
|
|
75697
|
+
*
|
|
75698
|
+
* // Using callbacks
|
|
75699
|
+
* async.concat(directoryList, fs.readdir, function(err, results) {
|
|
75700
|
+
* if (err) {
|
|
75701
|
+
* console.log(err);
|
|
75702
|
+
* } else {
|
|
75703
|
+
* console.log(results);
|
|
75704
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
75705
|
+
* }
|
|
75706
|
+
* });
|
|
75707
|
+
*
|
|
75708
|
+
* // Error Handling
|
|
75709
|
+
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
|
|
75710
|
+
* if (err) {
|
|
75711
|
+
* console.log(err);
|
|
75712
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75713
|
+
* // since dir4 does not exist
|
|
75714
|
+
* } else {
|
|
75715
|
+
* console.log(results);
|
|
75716
|
+
* }
|
|
75717
|
+
* });
|
|
75718
|
+
*
|
|
75719
|
+
* // Using Promises
|
|
75720
|
+
* async.concat(directoryList, fs.readdir)
|
|
75721
|
+
* .then(results => {
|
|
75722
|
+
* console.log(results);
|
|
75723
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
75724
|
+
* }).catch(err => {
|
|
75725
|
+
* console.log(err);
|
|
75726
|
+
* });
|
|
75727
|
+
*
|
|
75728
|
+
* // Error Handling
|
|
75729
|
+
* async.concat(withMissingDirectoryList, fs.readdir)
|
|
75730
|
+
* .then(results => {
|
|
75731
|
+
* console.log(results);
|
|
75732
|
+
* }).catch(err => {
|
|
75733
|
+
* console.log(err);
|
|
75734
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75735
|
+
* // since dir4 does not exist
|
|
75398
75736
|
* });
|
|
75737
|
+
*
|
|
75738
|
+
* // Using async/await
|
|
75739
|
+
* async () => {
|
|
75740
|
+
* try {
|
|
75741
|
+
* let results = await async.concat(directoryList, fs.readdir);
|
|
75742
|
+
* console.log(results);
|
|
75743
|
+
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
|
75744
|
+
* } catch (err) {
|
|
75745
|
+
* console.log(err);
|
|
75746
|
+
* }
|
|
75747
|
+
* }
|
|
75748
|
+
*
|
|
75749
|
+
* // Error Handling
|
|
75750
|
+
* async () => {
|
|
75751
|
+
* try {
|
|
75752
|
+
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
|
|
75753
|
+
* console.log(results);
|
|
75754
|
+
* } catch (err) {
|
|
75755
|
+
* console.log(err);
|
|
75756
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
75757
|
+
* // since dir4 does not exist
|
|
75758
|
+
* }
|
|
75759
|
+
* }
|
|
75760
|
+
*
|
|
75399
75761
|
*/
|
|
75400
75762
|
function concat(coll, iteratee, callback) {
|
|
75401
75763
|
return concatLimit$1(coll, Infinity, iteratee, callback)
|
|
@@ -75527,13 +75889,48 @@ function _createTester(check, getResult) {
|
|
|
75527
75889
|
* @returns A Promise, if no callback is passed
|
|
75528
75890
|
* @example
|
|
75529
75891
|
*
|
|
75530
|
-
*
|
|
75531
|
-
*
|
|
75532
|
-
*
|
|
75533
|
-
*
|
|
75534
|
-
*
|
|
75892
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
75893
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
75894
|
+
* // dir3 is a directory that contains file5.txt
|
|
75895
|
+
*
|
|
75896
|
+
* // asynchronous function that checks if a file exists
|
|
75897
|
+
* function fileExists(file, callback) {
|
|
75898
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
75899
|
+
* callback(null, !err);
|
|
75900
|
+
* });
|
|
75901
|
+
* }
|
|
75902
|
+
*
|
|
75903
|
+
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
|
|
75904
|
+
* function(err, result) {
|
|
75905
|
+
* console.log(result);
|
|
75906
|
+
* // dir1/file1.txt
|
|
75907
|
+
* // result now equals the first file in the list that exists
|
|
75908
|
+
* }
|
|
75909
|
+
*);
|
|
75910
|
+
*
|
|
75911
|
+
* // Using Promises
|
|
75912
|
+
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
|
|
75913
|
+
* .then(result => {
|
|
75914
|
+
* console.log(result);
|
|
75915
|
+
* // dir1/file1.txt
|
|
75535
75916
|
* // result now equals the first file in the list that exists
|
|
75917
|
+
* }).catch(err => {
|
|
75918
|
+
* console.log(err);
|
|
75536
75919
|
* });
|
|
75920
|
+
*
|
|
75921
|
+
* // Using async/await
|
|
75922
|
+
* async () => {
|
|
75923
|
+
* try {
|
|
75924
|
+
* let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
|
|
75925
|
+
* console.log(result);
|
|
75926
|
+
* // dir1/file1.txt
|
|
75927
|
+
* // result now equals the file in the list that exists
|
|
75928
|
+
* }
|
|
75929
|
+
* catch (err) {
|
|
75930
|
+
* console.log(err);
|
|
75931
|
+
* }
|
|
75932
|
+
* }
|
|
75933
|
+
*
|
|
75537
75934
|
*/
|
|
75538
75935
|
function detect(coll, iteratee, callback) {
|
|
75539
75936
|
return _createTester(bool => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback)
|
|
@@ -75597,12 +75994,15 @@ var detectSeries$1 = awaitify(detectSeries, 3);
|
|
|
75597
75994
|
|
|
75598
75995
|
function consoleFunc(name) {
|
|
75599
75996
|
return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => {
|
|
75997
|
+
/* istanbul ignore else */
|
|
75600
75998
|
if (typeof console === 'object') {
|
|
75999
|
+
/* istanbul ignore else */
|
|
75601
76000
|
if (err) {
|
|
76001
|
+
/* istanbul ignore else */
|
|
75602
76002
|
if (console.error) {
|
|
75603
76003
|
console.error(err);
|
|
75604
76004
|
}
|
|
75605
|
-
} else if (console[name]) {
|
|
76005
|
+
} else if (console[name]) { /* istanbul ignore else */
|
|
75606
76006
|
resultArgs.forEach(x => console[name](x));
|
|
75607
76007
|
}
|
|
75608
76008
|
}
|
|
@@ -75747,37 +76147,78 @@ function _withoutIndex(iteratee) {
|
|
|
75747
76147
|
* @returns {Promise} a promise, if a callback is omitted
|
|
75748
76148
|
* @example
|
|
75749
76149
|
*
|
|
75750
|
-
* //
|
|
75751
|
-
* //
|
|
75752
|
-
*
|
|
75753
|
-
*
|
|
75754
|
-
* // if any of the saves produced an error, err would equal that error
|
|
75755
|
-
* });
|
|
76150
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76151
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76152
|
+
* // dir3 is a directory that contains file5.txt
|
|
76153
|
+
* // dir4 does not exist
|
|
75756
76154
|
*
|
|
75757
|
-
*
|
|
75758
|
-
*
|
|
76155
|
+
* const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
|
|
76156
|
+
* const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
|
|
75759
76157
|
*
|
|
75760
|
-
*
|
|
75761
|
-
*
|
|
76158
|
+
* // asynchronous function that deletes a file
|
|
76159
|
+
* const deleteFile = function(file, callback) {
|
|
76160
|
+
* fs.unlink(file, callback);
|
|
76161
|
+
* };
|
|
75762
76162
|
*
|
|
75763
|
-
*
|
|
75764
|
-
*
|
|
75765
|
-
* callback('File name too long');
|
|
75766
|
-
* } else {
|
|
75767
|
-
* // Do work to process file here
|
|
75768
|
-
* console.log('File processed');
|
|
75769
|
-
* callback();
|
|
75770
|
-
* }
|
|
75771
|
-
* }, function(err) {
|
|
75772
|
-
* // if any of the file processing produced an error, err would equal that error
|
|
76163
|
+
* // Using callbacks
|
|
76164
|
+
* async.each(fileList, deleteFile, function(err) {
|
|
75773
76165
|
* if( err ) {
|
|
75774
|
-
*
|
|
75775
|
-
* // All processing will now stop.
|
|
75776
|
-
* console.log('A file failed to process');
|
|
76166
|
+
* console.log(err);
|
|
75777
76167
|
* } else {
|
|
75778
|
-
*
|
|
76168
|
+
* console.log('All files have been deleted successfully');
|
|
75779
76169
|
* }
|
|
75780
76170
|
* });
|
|
76171
|
+
*
|
|
76172
|
+
* // Error Handling
|
|
76173
|
+
* async.each(withMissingFileList, deleteFile, function(err){
|
|
76174
|
+
* console.log(err);
|
|
76175
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76176
|
+
* // since dir4/file2.txt does not exist
|
|
76177
|
+
* // dir1/file1.txt could have been deleted
|
|
76178
|
+
* });
|
|
76179
|
+
*
|
|
76180
|
+
* // Using Promises
|
|
76181
|
+
* async.each(fileList, deleteFile)
|
|
76182
|
+
* .then( () => {
|
|
76183
|
+
* console.log('All files have been deleted successfully');
|
|
76184
|
+
* }).catch( err => {
|
|
76185
|
+
* console.log(err);
|
|
76186
|
+
* });
|
|
76187
|
+
*
|
|
76188
|
+
* // Error Handling
|
|
76189
|
+
* async.each(fileList, deleteFile)
|
|
76190
|
+
* .then( () => {
|
|
76191
|
+
* console.log('All files have been deleted successfully');
|
|
76192
|
+
* }).catch( err => {
|
|
76193
|
+
* console.log(err);
|
|
76194
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76195
|
+
* // since dir4/file2.txt does not exist
|
|
76196
|
+
* // dir1/file1.txt could have been deleted
|
|
76197
|
+
* });
|
|
76198
|
+
*
|
|
76199
|
+
* // Using async/await
|
|
76200
|
+
* async () => {
|
|
76201
|
+
* try {
|
|
76202
|
+
* await async.each(files, deleteFile);
|
|
76203
|
+
* }
|
|
76204
|
+
* catch (err) {
|
|
76205
|
+
* console.log(err);
|
|
76206
|
+
* }
|
|
76207
|
+
* }
|
|
76208
|
+
*
|
|
76209
|
+
* // Error Handling
|
|
76210
|
+
* async () => {
|
|
76211
|
+
* try {
|
|
76212
|
+
* await async.each(withMissingFileList, deleteFile);
|
|
76213
|
+
* }
|
|
76214
|
+
* catch (err) {
|
|
76215
|
+
* console.log(err);
|
|
76216
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76217
|
+
* // since dir4/file2.txt does not exist
|
|
76218
|
+
* // dir1/file1.txt could have been deleted
|
|
76219
|
+
* }
|
|
76220
|
+
* }
|
|
76221
|
+
*
|
|
75781
76222
|
*/
|
|
75782
76223
|
function eachLimit(coll, iteratee, callback) {
|
|
75783
76224
|
return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback);
|
|
@@ -75912,13 +76353,78 @@ function ensureAsync(fn) {
|
|
|
75912
76353
|
* @returns {Promise} a promise, if no callback provided
|
|
75913
76354
|
* @example
|
|
75914
76355
|
*
|
|
75915
|
-
*
|
|
75916
|
-
*
|
|
75917
|
-
*
|
|
75918
|
-
*
|
|
75919
|
-
*
|
|
75920
|
-
*
|
|
76356
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76357
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76358
|
+
* // dir3 is a directory that contains file5.txt
|
|
76359
|
+
* // dir4 does not exist
|
|
76360
|
+
*
|
|
76361
|
+
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
|
76362
|
+
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
|
76363
|
+
*
|
|
76364
|
+
* // asynchronous function that checks if a file exists
|
|
76365
|
+
* function fileExists(file, callback) {
|
|
76366
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
76367
|
+
* callback(null, !err);
|
|
76368
|
+
* });
|
|
76369
|
+
* }
|
|
76370
|
+
*
|
|
76371
|
+
* // Using callbacks
|
|
76372
|
+
* async.every(fileList, fileExists, function(err, result) {
|
|
76373
|
+
* console.log(result);
|
|
76374
|
+
* // true
|
|
76375
|
+
* // result is true since every file exists
|
|
76376
|
+
* });
|
|
76377
|
+
*
|
|
76378
|
+
* async.every(withMissingFileList, fileExists, function(err, result) {
|
|
76379
|
+
* console.log(result);
|
|
76380
|
+
* // false
|
|
76381
|
+
* // result is false since NOT every file exists
|
|
76382
|
+
* });
|
|
76383
|
+
*
|
|
76384
|
+
* // Using Promises
|
|
76385
|
+
* async.every(fileList, fileExists)
|
|
76386
|
+
* .then( result => {
|
|
76387
|
+
* console.log(result);
|
|
76388
|
+
* // true
|
|
76389
|
+
* // result is true since every file exists
|
|
76390
|
+
* }).catch( err => {
|
|
76391
|
+
* console.log(err);
|
|
75921
76392
|
* });
|
|
76393
|
+
*
|
|
76394
|
+
* async.every(withMissingFileList, fileExists)
|
|
76395
|
+
* .then( result => {
|
|
76396
|
+
* console.log(result);
|
|
76397
|
+
* // false
|
|
76398
|
+
* // result is false since NOT every file exists
|
|
76399
|
+
* }).catch( err => {
|
|
76400
|
+
* console.log(err);
|
|
76401
|
+
* });
|
|
76402
|
+
*
|
|
76403
|
+
* // Using async/await
|
|
76404
|
+
* async () => {
|
|
76405
|
+
* try {
|
|
76406
|
+
* let result = await async.every(fileList, fileExists);
|
|
76407
|
+
* console.log(result);
|
|
76408
|
+
* // true
|
|
76409
|
+
* // result is true since every file exists
|
|
76410
|
+
* }
|
|
76411
|
+
* catch (err) {
|
|
76412
|
+
* console.log(err);
|
|
76413
|
+
* }
|
|
76414
|
+
* }
|
|
76415
|
+
*
|
|
76416
|
+
* async () => {
|
|
76417
|
+
* try {
|
|
76418
|
+
* let result = await async.every(withMissingFileList, fileExists);
|
|
76419
|
+
* console.log(result);
|
|
76420
|
+
* // false
|
|
76421
|
+
* // result is false since NOT every file exists
|
|
76422
|
+
* }
|
|
76423
|
+
* catch (err) {
|
|
76424
|
+
* console.log(err);
|
|
76425
|
+
* }
|
|
76426
|
+
* }
|
|
76427
|
+
*
|
|
75922
76428
|
*/
|
|
75923
76429
|
function every(coll, iteratee, callback) {
|
|
75924
76430
|
return _createTester(bool => !bool, res => !res)(eachOf$1, coll, iteratee, callback)
|
|
@@ -76036,13 +76542,53 @@ function _filter(eachfn, coll, iteratee, callback) {
|
|
|
76036
76542
|
* @returns {Promise} a promise, if no callback provided
|
|
76037
76543
|
* @example
|
|
76038
76544
|
*
|
|
76039
|
-
*
|
|
76040
|
-
*
|
|
76041
|
-
*
|
|
76042
|
-
*
|
|
76043
|
-
*
|
|
76044
|
-
*
|
|
76545
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76546
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76547
|
+
* // dir3 is a directory that contains file5.txt
|
|
76548
|
+
*
|
|
76549
|
+
* const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
|
76550
|
+
*
|
|
76551
|
+
* // asynchronous function that checks if a file exists
|
|
76552
|
+
* function fileExists(file, callback) {
|
|
76553
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
76554
|
+
* callback(null, !err);
|
|
76555
|
+
* });
|
|
76556
|
+
* }
|
|
76557
|
+
*
|
|
76558
|
+
* // Using callbacks
|
|
76559
|
+
* async.filter(files, fileExists, function(err, results) {
|
|
76560
|
+
* if(err) {
|
|
76561
|
+
* console.log(err);
|
|
76562
|
+
* } else {
|
|
76563
|
+
* console.log(results);
|
|
76564
|
+
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
76565
|
+
* // results is now an array of the existing files
|
|
76566
|
+
* }
|
|
76567
|
+
* });
|
|
76568
|
+
*
|
|
76569
|
+
* // Using Promises
|
|
76570
|
+
* async.filter(files, fileExists)
|
|
76571
|
+
* .then(results => {
|
|
76572
|
+
* console.log(results);
|
|
76573
|
+
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
76574
|
+
* // results is now an array of the existing files
|
|
76575
|
+
* }).catch(err => {
|
|
76576
|
+
* console.log(err);
|
|
76045
76577
|
* });
|
|
76578
|
+
*
|
|
76579
|
+
* // Using async/await
|
|
76580
|
+
* async () => {
|
|
76581
|
+
* try {
|
|
76582
|
+
* let results = await async.filter(files, fileExists);
|
|
76583
|
+
* console.log(results);
|
|
76584
|
+
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
|
76585
|
+
* // results is now an array of the existing files
|
|
76586
|
+
* }
|
|
76587
|
+
* catch (err) {
|
|
76588
|
+
* console.log(err);
|
|
76589
|
+
* }
|
|
76590
|
+
* }
|
|
76591
|
+
*
|
|
76046
76592
|
*/
|
|
76047
76593
|
function filter$1 (coll, iteratee, callback) {
|
|
76048
76594
|
return _filter(eachOf$1, coll, iteratee, callback)
|
|
@@ -76219,15 +76765,69 @@ var groupByLimit$1 = awaitify(groupByLimit, 4);
|
|
|
76219
76765
|
* @returns {Promise} a promise, if no callback is passed
|
|
76220
76766
|
* @example
|
|
76221
76767
|
*
|
|
76222
|
-
*
|
|
76223
|
-
*
|
|
76224
|
-
*
|
|
76225
|
-
*
|
|
76768
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
76769
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
76770
|
+
* // dir3 is a directory that contains file5.txt
|
|
76771
|
+
* // dir4 does not exist
|
|
76772
|
+
*
|
|
76773
|
+
* const files = ['dir1/file1.txt','dir2','dir4']
|
|
76774
|
+
*
|
|
76775
|
+
* // asynchronous function that detects file type as none, file, or directory
|
|
76776
|
+
* function detectFile(file, callback) {
|
|
76777
|
+
* fs.stat(file, function(err, stat) {
|
|
76778
|
+
* if (err) {
|
|
76779
|
+
* return callback(null, 'none');
|
|
76780
|
+
* }
|
|
76781
|
+
* callback(null, stat.isDirectory() ? 'directory' : 'file');
|
|
76226
76782
|
* });
|
|
76227
|
-
* }
|
|
76228
|
-
*
|
|
76229
|
-
*
|
|
76783
|
+
* }
|
|
76784
|
+
*
|
|
76785
|
+
* //Using callbacks
|
|
76786
|
+
* async.groupBy(files, detectFile, function(err, result) {
|
|
76787
|
+
* if(err) {
|
|
76788
|
+
* console.log(err);
|
|
76789
|
+
* } else {
|
|
76790
|
+
* console.log(result);
|
|
76791
|
+
* // {
|
|
76792
|
+
* // file: [ 'dir1/file1.txt' ],
|
|
76793
|
+
* // none: [ 'dir4' ],
|
|
76794
|
+
* // directory: [ 'dir2']
|
|
76795
|
+
* // }
|
|
76796
|
+
* // result is object containing the files grouped by type
|
|
76797
|
+
* }
|
|
76230
76798
|
* });
|
|
76799
|
+
*
|
|
76800
|
+
* // Using Promises
|
|
76801
|
+
* async.groupBy(files, detectFile)
|
|
76802
|
+
* .then( result => {
|
|
76803
|
+
* console.log(result);
|
|
76804
|
+
* // {
|
|
76805
|
+
* // file: [ 'dir1/file1.txt' ],
|
|
76806
|
+
* // none: [ 'dir4' ],
|
|
76807
|
+
* // directory: [ 'dir2']
|
|
76808
|
+
* // }
|
|
76809
|
+
* // result is object containing the files grouped by type
|
|
76810
|
+
* }).catch( err => {
|
|
76811
|
+
* console.log(err);
|
|
76812
|
+
* });
|
|
76813
|
+
*
|
|
76814
|
+
* // Using async/await
|
|
76815
|
+
* async () => {
|
|
76816
|
+
* try {
|
|
76817
|
+
* let result = await async.groupBy(files, detectFile);
|
|
76818
|
+
* console.log(result);
|
|
76819
|
+
* // {
|
|
76820
|
+
* // file: [ 'dir1/file1.txt' ],
|
|
76821
|
+
* // none: [ 'dir4' ],
|
|
76822
|
+
* // directory: [ 'dir2']
|
|
76823
|
+
* // }
|
|
76824
|
+
* // result is object containing the files grouped by type
|
|
76825
|
+
* }
|
|
76826
|
+
* catch (err) {
|
|
76827
|
+
* console.log(err);
|
|
76828
|
+
* }
|
|
76829
|
+
* }
|
|
76830
|
+
*
|
|
76231
76831
|
*/
|
|
76232
76832
|
function groupBy$1 (coll, iteratee, callback) {
|
|
76233
76833
|
return groupByLimit$1(coll, Infinity, iteratee, callback)
|
|
@@ -76248,7 +76848,7 @@ function groupBy$1 (coll, iteratee, callback) {
|
|
|
76248
76848
|
* The iteratee should complete with a `key` to group the value under.
|
|
76249
76849
|
* Invoked with (value, callback).
|
|
76250
76850
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
|
76251
|
-
* functions have finished, or an error occurs. Result is an `Object`
|
|
76851
|
+
* functions have finished, or an error occurs. Result is an `Object` whose
|
|
76252
76852
|
* properties are arrays of values which returned the corresponding key.
|
|
76253
76853
|
* @returns {Promise} a promise, if no callback is passed
|
|
76254
76854
|
*/
|
|
@@ -76352,20 +76952,110 @@ var mapValuesLimit$1 = awaitify(mapValuesLimit, 4);
|
|
|
76352
76952
|
* @returns {Promise} a promise, if no callback is passed
|
|
76353
76953
|
* @example
|
|
76354
76954
|
*
|
|
76355
|
-
*
|
|
76356
|
-
*
|
|
76357
|
-
*
|
|
76358
|
-
*
|
|
76359
|
-
*
|
|
76360
|
-
*
|
|
76361
|
-
*
|
|
76362
|
-
*
|
|
76955
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
76956
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
76957
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
76958
|
+
* // file4.txt does not exist
|
|
76959
|
+
*
|
|
76960
|
+
* const fileMap = {
|
|
76961
|
+
* f1: 'file1.txt',
|
|
76962
|
+
* f2: 'file2.txt',
|
|
76963
|
+
* f3: 'file3.txt'
|
|
76964
|
+
* };
|
|
76965
|
+
*
|
|
76966
|
+
* const withMissingFileMap = {
|
|
76967
|
+
* f1: 'file1.txt',
|
|
76968
|
+
* f2: 'file2.txt',
|
|
76969
|
+
* f3: 'file4.txt'
|
|
76970
|
+
* };
|
|
76971
|
+
*
|
|
76972
|
+
* // asynchronous function that returns the file size in bytes
|
|
76973
|
+
* function getFileSizeInBytes(file, key, callback) {
|
|
76974
|
+
* fs.stat(file, function(err, stat) {
|
|
76975
|
+
* if (err) {
|
|
76976
|
+
* return callback(err);
|
|
76977
|
+
* }
|
|
76978
|
+
* callback(null, stat.size);
|
|
76979
|
+
* });
|
|
76980
|
+
* }
|
|
76981
|
+
*
|
|
76982
|
+
* // Using callbacks
|
|
76983
|
+
* async.mapValues(fileMap, getFileSizeInBytes, function(err, result) {
|
|
76984
|
+
* if (err) {
|
|
76985
|
+
* console.log(err);
|
|
76986
|
+
* } else {
|
|
76987
|
+
* console.log(result);
|
|
76988
|
+
* // result is now a map of file size in bytes for each file, e.g.
|
|
76989
|
+
* // {
|
|
76990
|
+
* // f1: 1000,
|
|
76991
|
+
* // f2: 2000,
|
|
76992
|
+
* // f3: 3000
|
|
76993
|
+
* // }
|
|
76994
|
+
* }
|
|
76995
|
+
* });
|
|
76996
|
+
*
|
|
76997
|
+
* // Error handling
|
|
76998
|
+
* async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) {
|
|
76999
|
+
* if (err) {
|
|
77000
|
+
* console.log(err);
|
|
77001
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
77002
|
+
* } else {
|
|
77003
|
+
* console.log(result);
|
|
77004
|
+
* }
|
|
77005
|
+
* });
|
|
77006
|
+
*
|
|
77007
|
+
* // Using Promises
|
|
77008
|
+
* async.mapValues(fileMap, getFileSizeInBytes)
|
|
77009
|
+
* .then( result => {
|
|
77010
|
+
* console.log(result);
|
|
77011
|
+
* // result is now a map of file size in bytes for each file, e.g.
|
|
76363
77012
|
* // {
|
|
76364
|
-
* // f1:
|
|
76365
|
-
* // f2:
|
|
76366
|
-
* // f3:
|
|
77013
|
+
* // f1: 1000,
|
|
77014
|
+
* // f2: 2000,
|
|
77015
|
+
* // f3: 3000
|
|
76367
77016
|
* // }
|
|
77017
|
+
* }).catch (err => {
|
|
77018
|
+
* console.log(err);
|
|
77019
|
+
* });
|
|
77020
|
+
*
|
|
77021
|
+
* // Error Handling
|
|
77022
|
+
* async.mapValues(withMissingFileMap, getFileSizeInBytes)
|
|
77023
|
+
* .then( result => {
|
|
77024
|
+
* console.log(result);
|
|
77025
|
+
* }).catch (err => {
|
|
77026
|
+
* console.log(err);
|
|
77027
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
76368
77028
|
* });
|
|
77029
|
+
*
|
|
77030
|
+
* // Using async/await
|
|
77031
|
+
* async () => {
|
|
77032
|
+
* try {
|
|
77033
|
+
* let result = await async.mapValues(fileMap, getFileSizeInBytes);
|
|
77034
|
+
* console.log(result);
|
|
77035
|
+
* // result is now a map of file size in bytes for each file, e.g.
|
|
77036
|
+
* // {
|
|
77037
|
+
* // f1: 1000,
|
|
77038
|
+
* // f2: 2000,
|
|
77039
|
+
* // f3: 3000
|
|
77040
|
+
* // }
|
|
77041
|
+
* }
|
|
77042
|
+
* catch (err) {
|
|
77043
|
+
* console.log(err);
|
|
77044
|
+
* }
|
|
77045
|
+
* }
|
|
77046
|
+
*
|
|
77047
|
+
* // Error Handling
|
|
77048
|
+
* async () => {
|
|
77049
|
+
* try {
|
|
77050
|
+
* let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes);
|
|
77051
|
+
* console.log(result);
|
|
77052
|
+
* }
|
|
77053
|
+
* catch (err) {
|
|
77054
|
+
* console.log(err);
|
|
77055
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
77056
|
+
* }
|
|
77057
|
+
* }
|
|
77058
|
+
*
|
|
76369
77059
|
*/
|
|
76370
77060
|
function mapValues(obj, iteratee, callback) {
|
|
76371
77061
|
return mapValuesLimit$1(obj, Infinity, iteratee, callback)
|
|
@@ -76558,6 +77248,8 @@ var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
|
76558
77248
|
* @returns {Promise} a promise, if a callback is not passed
|
|
76559
77249
|
*
|
|
76560
77250
|
* @example
|
|
77251
|
+
*
|
|
77252
|
+
* //Using Callbacks
|
|
76561
77253
|
* async.parallel([
|
|
76562
77254
|
* function(callback) {
|
|
76563
77255
|
* setTimeout(function() {
|
|
@@ -76569,10 +77261,9 @@ var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
|
76569
77261
|
* callback(null, 'two');
|
|
76570
77262
|
* }, 100);
|
|
76571
77263
|
* }
|
|
76572
|
-
* ],
|
|
76573
|
-
*
|
|
76574
|
-
*
|
|
76575
|
-
* // the results array will equal ['one','two'] even though
|
|
77264
|
+
* ], function(err, results) {
|
|
77265
|
+
* console.log(results);
|
|
77266
|
+
* // results is equal to ['one','two'] even though
|
|
76576
77267
|
* // the second function had a shorter timeout.
|
|
76577
77268
|
* });
|
|
76578
77269
|
*
|
|
@@ -76589,8 +77280,96 @@ var _parallel = awaitify((eachfn, tasks, callback) => {
|
|
|
76589
77280
|
* }, 100);
|
|
76590
77281
|
* }
|
|
76591
77282
|
* }, function(err, results) {
|
|
76592
|
-
*
|
|
77283
|
+
* console.log(results);
|
|
77284
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
76593
77285
|
* });
|
|
77286
|
+
*
|
|
77287
|
+
* //Using Promises
|
|
77288
|
+
* async.parallel([
|
|
77289
|
+
* function(callback) {
|
|
77290
|
+
* setTimeout(function() {
|
|
77291
|
+
* callback(null, 'one');
|
|
77292
|
+
* }, 200);
|
|
77293
|
+
* },
|
|
77294
|
+
* function(callback) {
|
|
77295
|
+
* setTimeout(function() {
|
|
77296
|
+
* callback(null, 'two');
|
|
77297
|
+
* }, 100);
|
|
77298
|
+
* }
|
|
77299
|
+
* ]).then(results => {
|
|
77300
|
+
* console.log(results);
|
|
77301
|
+
* // results is equal to ['one','two'] even though
|
|
77302
|
+
* // the second function had a shorter timeout.
|
|
77303
|
+
* }).catch(err => {
|
|
77304
|
+
* console.log(err);
|
|
77305
|
+
* });
|
|
77306
|
+
*
|
|
77307
|
+
* // an example using an object instead of an array
|
|
77308
|
+
* async.parallel({
|
|
77309
|
+
* one: function(callback) {
|
|
77310
|
+
* setTimeout(function() {
|
|
77311
|
+
* callback(null, 1);
|
|
77312
|
+
* }, 200);
|
|
77313
|
+
* },
|
|
77314
|
+
* two: function(callback) {
|
|
77315
|
+
* setTimeout(function() {
|
|
77316
|
+
* callback(null, 2);
|
|
77317
|
+
* }, 100);
|
|
77318
|
+
* }
|
|
77319
|
+
* }).then(results => {
|
|
77320
|
+
* console.log(results);
|
|
77321
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
77322
|
+
* }).catch(err => {
|
|
77323
|
+
* console.log(err);
|
|
77324
|
+
* });
|
|
77325
|
+
*
|
|
77326
|
+
* //Using async/await
|
|
77327
|
+
* async () => {
|
|
77328
|
+
* try {
|
|
77329
|
+
* let results = await async.parallel([
|
|
77330
|
+
* function(callback) {
|
|
77331
|
+
* setTimeout(function() {
|
|
77332
|
+
* callback(null, 'one');
|
|
77333
|
+
* }, 200);
|
|
77334
|
+
* },
|
|
77335
|
+
* function(callback) {
|
|
77336
|
+
* setTimeout(function() {
|
|
77337
|
+
* callback(null, 'two');
|
|
77338
|
+
* }, 100);
|
|
77339
|
+
* }
|
|
77340
|
+
* ]);
|
|
77341
|
+
* console.log(results);
|
|
77342
|
+
* // results is equal to ['one','two'] even though
|
|
77343
|
+
* // the second function had a shorter timeout.
|
|
77344
|
+
* }
|
|
77345
|
+
* catch (err) {
|
|
77346
|
+
* console.log(err);
|
|
77347
|
+
* }
|
|
77348
|
+
* }
|
|
77349
|
+
*
|
|
77350
|
+
* // an example using an object instead of an array
|
|
77351
|
+
* async () => {
|
|
77352
|
+
* try {
|
|
77353
|
+
* let results = await async.parallel({
|
|
77354
|
+
* one: function(callback) {
|
|
77355
|
+
* setTimeout(function() {
|
|
77356
|
+
* callback(null, 1);
|
|
77357
|
+
* }, 200);
|
|
77358
|
+
* },
|
|
77359
|
+
* two: function(callback) {
|
|
77360
|
+
* setTimeout(function() {
|
|
77361
|
+
* callback(null, 2);
|
|
77362
|
+
* }, 100);
|
|
77363
|
+
* }
|
|
77364
|
+
* });
|
|
77365
|
+
* console.log(results);
|
|
77366
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
77367
|
+
* }
|
|
77368
|
+
* catch (err) {
|
|
77369
|
+
* console.log(err);
|
|
77370
|
+
* }
|
|
77371
|
+
* }
|
|
77372
|
+
*
|
|
76594
77373
|
*/
|
|
76595
77374
|
function parallel$1(tasks, callback) {
|
|
76596
77375
|
return _parallel(eachOf$1, tasks, callback);
|
|
@@ -76648,7 +77427,7 @@ function parallelLimit(tasks, limit, callback) {
|
|
|
76648
77427
|
* Invoke with `queue.unshift(task, [callback])`.
|
|
76649
77428
|
* @property {AsyncFunction} pushAsync - the same as `q.push`, except this returns
|
|
76650
77429
|
* a promise that rejects if an error occurs.
|
|
76651
|
-
* @property {AsyncFunction}
|
|
77430
|
+
* @property {AsyncFunction} unshiftAsync - the same as `q.unshift`, except this returns
|
|
76652
77431
|
* a promise that rejects if an error occurs.
|
|
76653
77432
|
* @property {Function} remove - remove items from the queue that match a test
|
|
76654
77433
|
* function. The test function will be passed an object with a `data` property,
|
|
@@ -76687,7 +77466,7 @@ function parallelLimit(tasks, limit, callback) {
|
|
|
76687
77466
|
* should be pushed to the queue after calling this function. Invoke with `queue.kill()`.
|
|
76688
77467
|
*
|
|
76689
77468
|
* @example
|
|
76690
|
-
* const q =
|
|
77469
|
+
* const q = async.queue(worker, 2)
|
|
76691
77470
|
* q.push(item1)
|
|
76692
77471
|
* q.push(item2)
|
|
76693
77472
|
* q.push(item3)
|
|
@@ -76910,6 +77689,7 @@ function smaller(x, y) {
|
|
|
76910
77689
|
function priorityQueue(worker, concurrency) {
|
|
76911
77690
|
// Start with a normal queue
|
|
76912
77691
|
var q = queue$1(worker, concurrency);
|
|
77692
|
+
var processingScheduled = false;
|
|
76913
77693
|
|
|
76914
77694
|
q._tasks = new Heap();
|
|
76915
77695
|
|
|
@@ -76937,7 +77717,13 @@ function priorityQueue(worker, concurrency) {
|
|
|
76937
77717
|
q._tasks.push(item);
|
|
76938
77718
|
}
|
|
76939
77719
|
|
|
76940
|
-
|
|
77720
|
+
if (!processingScheduled) {
|
|
77721
|
+
processingScheduled = true;
|
|
77722
|
+
setImmediate$1(() => {
|
|
77723
|
+
processingScheduled = false;
|
|
77724
|
+
q.process();
|
|
77725
|
+
});
|
|
77726
|
+
}
|
|
76941
77727
|
};
|
|
76942
77728
|
|
|
76943
77729
|
// Remove unshift function
|
|
@@ -77008,7 +77794,7 @@ var race$1$1 = awaitify(race$1, 2);
|
|
|
77008
77794
|
* @param {AsyncFunction} iteratee - A function applied to each item in the
|
|
77009
77795
|
* array to produce the next step in the reduction.
|
|
77010
77796
|
* The `iteratee` should complete with the next state of the reduction.
|
|
77011
|
-
* If the iteratee
|
|
77797
|
+
* If the iteratee completes with an error, the reduction is stopped and the
|
|
77012
77798
|
* main `callback` is immediately called with the error.
|
|
77013
77799
|
* Invoked with (memo, item, callback).
|
|
77014
77800
|
* @param {Function} [callback] - A callback which is called after all the
|
|
@@ -77190,14 +77976,48 @@ function reject(eachfn, arr, _iteratee, callback) {
|
|
|
77190
77976
|
* @returns {Promise} a promise, if no callback is passed
|
|
77191
77977
|
* @example
|
|
77192
77978
|
*
|
|
77193
|
-
*
|
|
77194
|
-
*
|
|
77195
|
-
*
|
|
77196
|
-
*
|
|
77197
|
-
*
|
|
77198
|
-
*
|
|
77199
|
-
*
|
|
77979
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
77980
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
77981
|
+
* // dir3 is a directory that contains file5.txt
|
|
77982
|
+
*
|
|
77983
|
+
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
|
77984
|
+
*
|
|
77985
|
+
* // asynchronous function that checks if a file exists
|
|
77986
|
+
* function fileExists(file, callback) {
|
|
77987
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
77988
|
+
* callback(null, !err);
|
|
77989
|
+
* });
|
|
77990
|
+
* }
|
|
77991
|
+
*
|
|
77992
|
+
* // Using callbacks
|
|
77993
|
+
* async.reject(fileList, fileExists, function(err, results) {
|
|
77994
|
+
* // [ 'dir3/file6.txt' ]
|
|
77995
|
+
* // results now equals an array of the non-existing files
|
|
77200
77996
|
* });
|
|
77997
|
+
*
|
|
77998
|
+
* // Using Promises
|
|
77999
|
+
* async.reject(fileList, fileExists)
|
|
78000
|
+
* .then( results => {
|
|
78001
|
+
* console.log(results);
|
|
78002
|
+
* // [ 'dir3/file6.txt' ]
|
|
78003
|
+
* // results now equals an array of the non-existing files
|
|
78004
|
+
* }).catch( err => {
|
|
78005
|
+
* console.log(err);
|
|
78006
|
+
* });
|
|
78007
|
+
*
|
|
78008
|
+
* // Using async/await
|
|
78009
|
+
* async () => {
|
|
78010
|
+
* try {
|
|
78011
|
+
* let results = await async.reject(fileList, fileExists);
|
|
78012
|
+
* console.log(results);
|
|
78013
|
+
* // [ 'dir3/file6.txt' ]
|
|
78014
|
+
* // results now equals an array of the non-existing files
|
|
78015
|
+
* }
|
|
78016
|
+
* catch (err) {
|
|
78017
|
+
* console.log(err);
|
|
78018
|
+
* }
|
|
78019
|
+
* }
|
|
78020
|
+
*
|
|
77201
78021
|
*/
|
|
77202
78022
|
function reject$1 (coll, iteratee, callback) {
|
|
77203
78023
|
return reject(eachOf$1, coll, iteratee, callback)
|
|
@@ -77490,35 +78310,135 @@ function retryable (opts, task) {
|
|
|
77490
78310
|
* with (err, result).
|
|
77491
78311
|
* @return {Promise} a promise, if no callback is passed
|
|
77492
78312
|
* @example
|
|
78313
|
+
*
|
|
78314
|
+
* //Using Callbacks
|
|
77493
78315
|
* async.series([
|
|
77494
78316
|
* function(callback) {
|
|
77495
|
-
*
|
|
77496
|
-
*
|
|
78317
|
+
* setTimeout(function() {
|
|
78318
|
+
* // do some async task
|
|
78319
|
+
* callback(null, 'one');
|
|
78320
|
+
* }, 200);
|
|
77497
78321
|
* },
|
|
77498
78322
|
* function(callback) {
|
|
77499
|
-
*
|
|
77500
|
-
*
|
|
78323
|
+
* setTimeout(function() {
|
|
78324
|
+
* // then do another async task
|
|
78325
|
+
* callback(null, 'two');
|
|
78326
|
+
* }, 100);
|
|
77501
78327
|
* }
|
|
77502
|
-
* ],
|
|
77503
|
-
*
|
|
77504
|
-
*
|
|
77505
|
-
* // results is now equal to ['one', 'two']
|
|
78328
|
+
* ], function(err, results) {
|
|
78329
|
+
* console.log(results);
|
|
78330
|
+
* // results is equal to ['one','two']
|
|
77506
78331
|
* });
|
|
77507
78332
|
*
|
|
78333
|
+
* // an example using objects instead of arrays
|
|
77508
78334
|
* async.series({
|
|
77509
78335
|
* one: function(callback) {
|
|
77510
78336
|
* setTimeout(function() {
|
|
78337
|
+
* // do some async task
|
|
77511
78338
|
* callback(null, 1);
|
|
77512
78339
|
* }, 200);
|
|
77513
78340
|
* },
|
|
77514
|
-
* two: function(callback){
|
|
78341
|
+
* two: function(callback) {
|
|
77515
78342
|
* setTimeout(function() {
|
|
78343
|
+
* // then do another async task
|
|
77516
78344
|
* callback(null, 2);
|
|
77517
78345
|
* }, 100);
|
|
77518
78346
|
* }
|
|
77519
78347
|
* }, function(err, results) {
|
|
77520
|
-
*
|
|
78348
|
+
* console.log(results);
|
|
78349
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
78350
|
+
* });
|
|
78351
|
+
*
|
|
78352
|
+
* //Using Promises
|
|
78353
|
+
* async.series([
|
|
78354
|
+
* function(callback) {
|
|
78355
|
+
* setTimeout(function() {
|
|
78356
|
+
* callback(null, 'one');
|
|
78357
|
+
* }, 200);
|
|
78358
|
+
* },
|
|
78359
|
+
* function(callback) {
|
|
78360
|
+
* setTimeout(function() {
|
|
78361
|
+
* callback(null, 'two');
|
|
78362
|
+
* }, 100);
|
|
78363
|
+
* }
|
|
78364
|
+
* ]).then(results => {
|
|
78365
|
+
* console.log(results);
|
|
78366
|
+
* // results is equal to ['one','two']
|
|
78367
|
+
* }).catch(err => {
|
|
78368
|
+
* console.log(err);
|
|
78369
|
+
* });
|
|
78370
|
+
*
|
|
78371
|
+
* // an example using an object instead of an array
|
|
78372
|
+
* async.series({
|
|
78373
|
+
* one: function(callback) {
|
|
78374
|
+
* setTimeout(function() {
|
|
78375
|
+
* // do some async task
|
|
78376
|
+
* callback(null, 1);
|
|
78377
|
+
* }, 200);
|
|
78378
|
+
* },
|
|
78379
|
+
* two: function(callback) {
|
|
78380
|
+
* setTimeout(function() {
|
|
78381
|
+
* // then do another async task
|
|
78382
|
+
* callback(null, 2);
|
|
78383
|
+
* }, 100);
|
|
78384
|
+
* }
|
|
78385
|
+
* }).then(results => {
|
|
78386
|
+
* console.log(results);
|
|
78387
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
78388
|
+
* }).catch(err => {
|
|
78389
|
+
* console.log(err);
|
|
77521
78390
|
* });
|
|
78391
|
+
*
|
|
78392
|
+
* //Using async/await
|
|
78393
|
+
* async () => {
|
|
78394
|
+
* try {
|
|
78395
|
+
* let results = await async.series([
|
|
78396
|
+
* function(callback) {
|
|
78397
|
+
* setTimeout(function() {
|
|
78398
|
+
* // do some async task
|
|
78399
|
+
* callback(null, 'one');
|
|
78400
|
+
* }, 200);
|
|
78401
|
+
* },
|
|
78402
|
+
* function(callback) {
|
|
78403
|
+
* setTimeout(function() {
|
|
78404
|
+
* // then do another async task
|
|
78405
|
+
* callback(null, 'two');
|
|
78406
|
+
* }, 100);
|
|
78407
|
+
* }
|
|
78408
|
+
* ]);
|
|
78409
|
+
* console.log(results);
|
|
78410
|
+
* // results is equal to ['one','two']
|
|
78411
|
+
* }
|
|
78412
|
+
* catch (err) {
|
|
78413
|
+
* console.log(err);
|
|
78414
|
+
* }
|
|
78415
|
+
* }
|
|
78416
|
+
*
|
|
78417
|
+
* // an example using an object instead of an array
|
|
78418
|
+
* async () => {
|
|
78419
|
+
* try {
|
|
78420
|
+
* let results = await async.parallel({
|
|
78421
|
+
* one: function(callback) {
|
|
78422
|
+
* setTimeout(function() {
|
|
78423
|
+
* // do some async task
|
|
78424
|
+
* callback(null, 1);
|
|
78425
|
+
* }, 200);
|
|
78426
|
+
* },
|
|
78427
|
+
* two: function(callback) {
|
|
78428
|
+
* setTimeout(function() {
|
|
78429
|
+
* // then do another async task
|
|
78430
|
+
* callback(null, 2);
|
|
78431
|
+
* }, 100);
|
|
78432
|
+
* }
|
|
78433
|
+
* });
|
|
78434
|
+
* console.log(results);
|
|
78435
|
+
* // results is equal to: { one: 1, two: 2 }
|
|
78436
|
+
* }
|
|
78437
|
+
* catch (err) {
|
|
78438
|
+
* console.log(err);
|
|
78439
|
+
* }
|
|
78440
|
+
* }
|
|
78441
|
+
*
|
|
77522
78442
|
*/
|
|
77523
78443
|
function series(tasks, callback) {
|
|
77524
78444
|
return _parallel(eachOfSeries$1, tasks, callback);
|
|
@@ -77547,13 +78467,79 @@ function series(tasks, callback) {
|
|
|
77547
78467
|
* @returns {Promise} a promise, if no callback provided
|
|
77548
78468
|
* @example
|
|
77549
78469
|
*
|
|
77550
|
-
*
|
|
77551
|
-
*
|
|
77552
|
-
*
|
|
77553
|
-
*
|
|
77554
|
-
*
|
|
77555
|
-
*
|
|
78470
|
+
* // dir1 is a directory that contains file1.txt, file2.txt
|
|
78471
|
+
* // dir2 is a directory that contains file3.txt, file4.txt
|
|
78472
|
+
* // dir3 is a directory that contains file5.txt
|
|
78473
|
+
* // dir4 does not exist
|
|
78474
|
+
*
|
|
78475
|
+
* // asynchronous function that checks if a file exists
|
|
78476
|
+
* function fileExists(file, callback) {
|
|
78477
|
+
* fs.access(file, fs.constants.F_OK, (err) => {
|
|
78478
|
+
* callback(null, !err);
|
|
78479
|
+
* });
|
|
78480
|
+
* }
|
|
78481
|
+
*
|
|
78482
|
+
* // Using callbacks
|
|
78483
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
|
|
78484
|
+
* function(err, result) {
|
|
78485
|
+
* console.log(result);
|
|
78486
|
+
* // true
|
|
78487
|
+
* // result is true since some file in the list exists
|
|
78488
|
+
* }
|
|
78489
|
+
*);
|
|
78490
|
+
*
|
|
78491
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
|
|
78492
|
+
* function(err, result) {
|
|
78493
|
+
* console.log(result);
|
|
78494
|
+
* // false
|
|
78495
|
+
* // result is false since none of the files exists
|
|
78496
|
+
* }
|
|
78497
|
+
*);
|
|
78498
|
+
*
|
|
78499
|
+
* // Using Promises
|
|
78500
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
|
|
78501
|
+
* .then( result => {
|
|
78502
|
+
* console.log(result);
|
|
78503
|
+
* // true
|
|
78504
|
+
* // result is true since some file in the list exists
|
|
78505
|
+
* }).catch( err => {
|
|
78506
|
+
* console.log(err);
|
|
77556
78507
|
* });
|
|
78508
|
+
*
|
|
78509
|
+
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
|
|
78510
|
+
* .then( result => {
|
|
78511
|
+
* console.log(result);
|
|
78512
|
+
* // false
|
|
78513
|
+
* // result is false since none of the files exists
|
|
78514
|
+
* }).catch( err => {
|
|
78515
|
+
* console.log(err);
|
|
78516
|
+
* });
|
|
78517
|
+
*
|
|
78518
|
+
* // Using async/await
|
|
78519
|
+
* async () => {
|
|
78520
|
+
* try {
|
|
78521
|
+
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
|
|
78522
|
+
* console.log(result);
|
|
78523
|
+
* // true
|
|
78524
|
+
* // result is true since some file in the list exists
|
|
78525
|
+
* }
|
|
78526
|
+
* catch (err) {
|
|
78527
|
+
* console.log(err);
|
|
78528
|
+
* }
|
|
78529
|
+
* }
|
|
78530
|
+
*
|
|
78531
|
+
* async () => {
|
|
78532
|
+
* try {
|
|
78533
|
+
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
|
|
78534
|
+
* console.log(result);
|
|
78535
|
+
* // false
|
|
78536
|
+
* // result is false since none of the files exists
|
|
78537
|
+
* }
|
|
78538
|
+
* catch (err) {
|
|
78539
|
+
* console.log(err);
|
|
78540
|
+
* }
|
|
78541
|
+
* }
|
|
78542
|
+
*
|
|
77557
78543
|
*/
|
|
77558
78544
|
function some(coll, iteratee, callback) {
|
|
77559
78545
|
return _createTester(Boolean, res => res)(eachOf$1, coll, iteratee, callback)
|
|
@@ -77635,31 +78621,133 @@ var someSeries$1 = awaitify(someSeries, 3);
|
|
|
77635
78621
|
* @returns {Promise} a promise, if no callback passed
|
|
77636
78622
|
* @example
|
|
77637
78623
|
*
|
|
77638
|
-
*
|
|
77639
|
-
*
|
|
77640
|
-
*
|
|
78624
|
+
* // bigfile.txt is a file that is 251100 bytes in size
|
|
78625
|
+
* // mediumfile.txt is a file that is 11000 bytes in size
|
|
78626
|
+
* // smallfile.txt is a file that is 121 bytes in size
|
|
78627
|
+
*
|
|
78628
|
+
* // asynchronous function that returns the file size in bytes
|
|
78629
|
+
* function getFileSizeInBytes(file, callback) {
|
|
78630
|
+
* fs.stat(file, function(err, stat) {
|
|
78631
|
+
* if (err) {
|
|
78632
|
+
* return callback(err);
|
|
78633
|
+
* }
|
|
78634
|
+
* callback(null, stat.size);
|
|
77641
78635
|
* });
|
|
77642
|
-
* }
|
|
77643
|
-
*
|
|
77644
|
-
*
|
|
77645
|
-
*
|
|
78636
|
+
* }
|
|
78637
|
+
*
|
|
78638
|
+
* // Using callbacks
|
|
78639
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes,
|
|
78640
|
+
* function(err, results) {
|
|
78641
|
+
* if (err) {
|
|
78642
|
+
* console.log(err);
|
|
78643
|
+
* } else {
|
|
78644
|
+
* console.log(results);
|
|
78645
|
+
* // results is now the original array of files sorted by
|
|
78646
|
+
* // file size (ascending by default), e.g.
|
|
78647
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78648
|
+
* }
|
|
78649
|
+
* }
|
|
78650
|
+
* );
|
|
77646
78651
|
*
|
|
77647
78652
|
* // By modifying the callback parameter the
|
|
77648
78653
|
* // sorting order can be influenced:
|
|
77649
78654
|
*
|
|
77650
78655
|
* // ascending order
|
|
77651
|
-
* async.sortBy([
|
|
77652
|
-
*
|
|
77653
|
-
*
|
|
77654
|
-
*
|
|
77655
|
-
*
|
|
78656
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) {
|
|
78657
|
+
* getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
|
|
78658
|
+
* if (getFileSizeErr) return callback(getFileSizeErr);
|
|
78659
|
+
* callback(null, fileSize);
|
|
78660
|
+
* });
|
|
78661
|
+
* }, function(err, results) {
|
|
78662
|
+
* if (err) {
|
|
78663
|
+
* console.log(err);
|
|
78664
|
+
* } else {
|
|
78665
|
+
* console.log(results);
|
|
78666
|
+
* // results is now the original array of files sorted by
|
|
78667
|
+
* // file size (ascending by default), e.g.
|
|
78668
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78669
|
+
* }
|
|
78670
|
+
* }
|
|
78671
|
+
* );
|
|
77656
78672
|
*
|
|
77657
78673
|
* // descending order
|
|
77658
|
-
* async.sortBy([
|
|
77659
|
-
*
|
|
77660
|
-
*
|
|
77661
|
-
*
|
|
78674
|
+
* async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) {
|
|
78675
|
+
* getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
|
|
78676
|
+
* if (getFileSizeErr) {
|
|
78677
|
+
* return callback(getFileSizeErr);
|
|
78678
|
+
* }
|
|
78679
|
+
* callback(null, fileSize * -1);
|
|
78680
|
+
* });
|
|
78681
|
+
* }, function(err, results) {
|
|
78682
|
+
* if (err) {
|
|
78683
|
+
* console.log(err);
|
|
78684
|
+
* } else {
|
|
78685
|
+
* console.log(results);
|
|
78686
|
+
* // results is now the original array of files sorted by
|
|
78687
|
+
* // file size (ascending by default), e.g.
|
|
78688
|
+
* // [ 'bigfile.txt', 'mediumfile.txt', 'smallfile.txt']
|
|
78689
|
+
* }
|
|
78690
|
+
* }
|
|
78691
|
+
* );
|
|
78692
|
+
*
|
|
78693
|
+
* // Error handling
|
|
78694
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes,
|
|
78695
|
+
* function(err, results) {
|
|
78696
|
+
* if (err) {
|
|
78697
|
+
* console.log(err);
|
|
78698
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
78699
|
+
* } else {
|
|
78700
|
+
* console.log(results);
|
|
78701
|
+
* }
|
|
78702
|
+
* }
|
|
78703
|
+
* );
|
|
78704
|
+
*
|
|
78705
|
+
* // Using Promises
|
|
78706
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes)
|
|
78707
|
+
* .then( results => {
|
|
78708
|
+
* console.log(results);
|
|
78709
|
+
* // results is now the original array of files sorted by
|
|
78710
|
+
* // file size (ascending by default), e.g.
|
|
78711
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78712
|
+
* }).catch( err => {
|
|
78713
|
+
* console.log(err);
|
|
77662
78714
|
* });
|
|
78715
|
+
*
|
|
78716
|
+
* // Error handling
|
|
78717
|
+
* async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes)
|
|
78718
|
+
* .then( results => {
|
|
78719
|
+
* console.log(results);
|
|
78720
|
+
* }).catch( err => {
|
|
78721
|
+
* console.log(err);
|
|
78722
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
78723
|
+
* });
|
|
78724
|
+
*
|
|
78725
|
+
* // Using async/await
|
|
78726
|
+
* (async () => {
|
|
78727
|
+
* try {
|
|
78728
|
+
* let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
|
|
78729
|
+
* console.log(results);
|
|
78730
|
+
* // results is now the original array of files sorted by
|
|
78731
|
+
* // file size (ascending by default), e.g.
|
|
78732
|
+
* // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
|
|
78733
|
+
* }
|
|
78734
|
+
* catch (err) {
|
|
78735
|
+
* console.log(err);
|
|
78736
|
+
* }
|
|
78737
|
+
* })();
|
|
78738
|
+
*
|
|
78739
|
+
* // Error handling
|
|
78740
|
+
* async () => {
|
|
78741
|
+
* try {
|
|
78742
|
+
* let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
|
|
78743
|
+
* console.log(results);
|
|
78744
|
+
* }
|
|
78745
|
+
* catch (err) {
|
|
78746
|
+
* console.log(err);
|
|
78747
|
+
* // [ Error: ENOENT: no such file or directory ]
|
|
78748
|
+
* }
|
|
78749
|
+
* }
|
|
78750
|
+
*
|
|
77663
78751
|
*/
|
|
77664
78752
|
function sortBy$1 (coll, iteratee, callback) {
|
|
77665
78753
|
var _iteratee = wrapAsync(iteratee);
|
|
@@ -77860,26 +78948,118 @@ function timesSeries (n, iteratee, callback) {
|
|
|
77860
78948
|
* @returns {Promise} a promise, if no callback provided
|
|
77861
78949
|
* @example
|
|
77862
78950
|
*
|
|
77863
|
-
*
|
|
77864
|
-
*
|
|
77865
|
-
*
|
|
77866
|
-
*
|
|
77867
|
-
*
|
|
78951
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
78952
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
78953
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
78954
|
+
*
|
|
78955
|
+
* // helper function that returns human-readable size format from bytes
|
|
78956
|
+
* function formatBytes(bytes, decimals = 2) {
|
|
78957
|
+
* // implementation not included for brevity
|
|
78958
|
+
* return humanReadbleFilesize;
|
|
78959
|
+
* }
|
|
78960
|
+
*
|
|
78961
|
+
* const fileList = ['file1.txt','file2.txt','file3.txt'];
|
|
78962
|
+
*
|
|
78963
|
+
* // asynchronous function that returns the file size, transformed to human-readable format
|
|
78964
|
+
* // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
|
|
78965
|
+
* function transformFileSize(acc, value, key, callback) {
|
|
78966
|
+
* fs.stat(value, function(err, stat) {
|
|
78967
|
+
* if (err) {
|
|
78968
|
+
* return callback(err);
|
|
78969
|
+
* }
|
|
78970
|
+
* acc[key] = formatBytes(stat.size);
|
|
78971
|
+
* callback(null);
|
|
77868
78972
|
* });
|
|
77869
|
-
* }
|
|
77870
|
-
*
|
|
78973
|
+
* }
|
|
78974
|
+
*
|
|
78975
|
+
* // Using callbacks
|
|
78976
|
+
* async.transform(fileList, transformFileSize, function(err, result) {
|
|
78977
|
+
* if(err) {
|
|
78978
|
+
* console.log(err);
|
|
78979
|
+
* } else {
|
|
78980
|
+
* console.log(result);
|
|
78981
|
+
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
78982
|
+
* }
|
|
78983
|
+
* });
|
|
78984
|
+
*
|
|
78985
|
+
* // Using Promises
|
|
78986
|
+
* async.transform(fileList, transformFileSize)
|
|
78987
|
+
* .then(result => {
|
|
78988
|
+
* console.log(result);
|
|
78989
|
+
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
78990
|
+
* }).catch(err => {
|
|
78991
|
+
* console.log(err);
|
|
77871
78992
|
* });
|
|
77872
78993
|
*
|
|
78994
|
+
* // Using async/await
|
|
78995
|
+
* (async () => {
|
|
78996
|
+
* try {
|
|
78997
|
+
* let result = await async.transform(fileList, transformFileSize);
|
|
78998
|
+
* console.log(result);
|
|
78999
|
+
* // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
|
|
79000
|
+
* }
|
|
79001
|
+
* catch (err) {
|
|
79002
|
+
* console.log(err);
|
|
79003
|
+
* }
|
|
79004
|
+
* })();
|
|
79005
|
+
*
|
|
77873
79006
|
* @example
|
|
77874
79007
|
*
|
|
77875
|
-
*
|
|
77876
|
-
*
|
|
77877
|
-
*
|
|
77878
|
-
*
|
|
77879
|
-
*
|
|
77880
|
-
*
|
|
77881
|
-
*
|
|
77882
|
-
*
|
|
79008
|
+
* // file1.txt is a file that is 1000 bytes in size
|
|
79009
|
+
* // file2.txt is a file that is 2000 bytes in size
|
|
79010
|
+
* // file3.txt is a file that is 3000 bytes in size
|
|
79011
|
+
*
|
|
79012
|
+
* // helper function that returns human-readable size format from bytes
|
|
79013
|
+
* function formatBytes(bytes, decimals = 2) {
|
|
79014
|
+
* // implementation not included for brevity
|
|
79015
|
+
* return humanReadbleFilesize;
|
|
79016
|
+
* }
|
|
79017
|
+
*
|
|
79018
|
+
* const fileMap = { f1: 'file1.txt', f2: 'file2.txt', f3: 'file3.txt' };
|
|
79019
|
+
*
|
|
79020
|
+
* // asynchronous function that returns the file size, transformed to human-readable format
|
|
79021
|
+
* // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
|
|
79022
|
+
* function transformFileSize(acc, value, key, callback) {
|
|
79023
|
+
* fs.stat(value, function(err, stat) {
|
|
79024
|
+
* if (err) {
|
|
79025
|
+
* return callback(err);
|
|
79026
|
+
* }
|
|
79027
|
+
* acc[key] = formatBytes(stat.size);
|
|
79028
|
+
* callback(null);
|
|
79029
|
+
* });
|
|
79030
|
+
* }
|
|
79031
|
+
*
|
|
79032
|
+
* // Using callbacks
|
|
79033
|
+
* async.transform(fileMap, transformFileSize, function(err, result) {
|
|
79034
|
+
* if(err) {
|
|
79035
|
+
* console.log(err);
|
|
79036
|
+
* } else {
|
|
79037
|
+
* console.log(result);
|
|
79038
|
+
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
79039
|
+
* }
|
|
79040
|
+
* });
|
|
79041
|
+
*
|
|
79042
|
+
* // Using Promises
|
|
79043
|
+
* async.transform(fileMap, transformFileSize)
|
|
79044
|
+
* .then(result => {
|
|
79045
|
+
* console.log(result);
|
|
79046
|
+
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
79047
|
+
* }).catch(err => {
|
|
79048
|
+
* console.log(err);
|
|
79049
|
+
* });
|
|
79050
|
+
*
|
|
79051
|
+
* // Using async/await
|
|
79052
|
+
* async () => {
|
|
79053
|
+
* try {
|
|
79054
|
+
* let result = await async.transform(fileMap, transformFileSize);
|
|
79055
|
+
* console.log(result);
|
|
79056
|
+
* // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
|
|
79057
|
+
* }
|
|
79058
|
+
* catch (err) {
|
|
79059
|
+
* console.log(err);
|
|
79060
|
+
* }
|
|
79061
|
+
* }
|
|
79062
|
+
*
|
|
77883
79063
|
*/
|
|
77884
79064
|
function transform (coll, accumulator, iteratee, callback) {
|
|
77885
79065
|
if (arguments.length <= 3 && typeof accumulator === 'function') {
|
|
@@ -78057,7 +79237,7 @@ var whilst$1 = awaitify(whilst, 3);
|
|
|
78057
79237
|
* @example
|
|
78058
79238
|
* const results = []
|
|
78059
79239
|
* let finished = false
|
|
78060
|
-
* async.until(function test(
|
|
79240
|
+
* async.until(function test(cb) {
|
|
78061
79241
|
* cb(null, finished)
|
|
78062
79242
|
* }, function iter(next) {
|
|
78063
79243
|
* fetchPage(url, (err, body) => {
|
|
@@ -92447,9 +93627,16 @@ ZipArchiveEntry.prototype.setMethod = function(method) {
|
|
|
92447
93627
|
* Sets the name of the entry.
|
|
92448
93628
|
*
|
|
92449
93629
|
* @param name
|
|
93630
|
+
* @param prependSlash
|
|
92450
93631
|
*/
|
|
92451
|
-
ZipArchiveEntry.prototype.setName = function(name) {
|
|
92452
|
-
name = normalizePath(name, false)
|
|
93632
|
+
ZipArchiveEntry.prototype.setName = function(name, prependSlash = false) {
|
|
93633
|
+
name = normalizePath(name, false)
|
|
93634
|
+
.replace(/^\w+:/, '')
|
|
93635
|
+
.replace(/^(\.\.\/|\/)+/, '');
|
|
93636
|
+
|
|
93637
|
+
if (prependSlash) {
|
|
93638
|
+
name = `/${name}`;
|
|
93639
|
+
}
|
|
92453
93640
|
|
|
92454
93641
|
if (Buffer.byteLength(name) !== name.length) {
|
|
92455
93642
|
this.getGeneralPurposeBit().useUTF8ForNames(true);
|
|
@@ -98953,13 +100140,13 @@ class DeflateCRC32Stream extends DeflateRaw {
|
|
|
98953
100140
|
return super.push(chunk, encoding);
|
|
98954
100141
|
}
|
|
98955
100142
|
|
|
98956
|
-
|
|
100143
|
+
_transform(chunk, encoding, callback) {
|
|
98957
100144
|
if (chunk) {
|
|
98958
100145
|
this.checksum = crc32$1.buf(chunk, this.checksum) >>> 0;
|
|
98959
100146
|
this.rawSize += chunk.length;
|
|
98960
100147
|
}
|
|
98961
100148
|
|
|
98962
|
-
|
|
100149
|
+
super._transform(chunk, encoding, callback);
|
|
98963
100150
|
}
|
|
98964
100151
|
|
|
98965
100152
|
digest(encoding) {
|
|
@@ -99501,6 +100688,8 @@ var ZipStream = module.exports = function(options) {
|
|
|
99501
100688
|
options.store = true;
|
|
99502
100689
|
}
|
|
99503
100690
|
|
|
100691
|
+
options.namePrependSlash = options.namePrependSlash || false;
|
|
100692
|
+
|
|
99504
100693
|
if (options.comment && options.comment.length > 0) {
|
|
99505
100694
|
this.setComment(options.comment);
|
|
99506
100695
|
}
|
|
@@ -99519,6 +100708,7 @@ ZipStream.prototype._normalizeFileData = function(data) {
|
|
|
99519
100708
|
data = archiverUtils.defaults(data, {
|
|
99520
100709
|
type: 'file',
|
|
99521
100710
|
name: null,
|
|
100711
|
+
namePrependSlash: this.options.namePrependSlash,
|
|
99522
100712
|
linkname: null,
|
|
99523
100713
|
date: null,
|
|
99524
100714
|
mode: null,
|
|
@@ -99589,6 +100779,10 @@ ZipStream.prototype.entry = function(source, data, callback) {
|
|
|
99589
100779
|
var entry = new ZipArchiveEntry(data.name);
|
|
99590
100780
|
entry.setTime(data.date, this.options.forceLocalTime);
|
|
99591
100781
|
|
|
100782
|
+
if (data.namePrependSlash) {
|
|
100783
|
+
entry.setName(data.name, true);
|
|
100784
|
+
}
|
|
100785
|
+
|
|
99592
100786
|
if (data.store) {
|
|
99593
100787
|
entry.setMethod(0);
|
|
99594
100788
|
}
|
|
@@ -99653,6 +100847,7 @@ ZipStream.prototype.finalize = function() {
|
|
|
99653
100847
|
* @param {String} [options.comment] Sets the zip archive comment.
|
|
99654
100848
|
* @param {Boolean} [options.forceLocalTime=false] Forces the archive to contain local file times instead of UTC.
|
|
99655
100849
|
* @param {Boolean} [options.forceZip64=false] Forces the archive to contain ZIP64 headers.
|
|
100850
|
+
* @param {Boolean} [options.namePrependSlash=false] Prepends a forward slash to archive file paths.
|
|
99656
100851
|
* @param {Boolean} [options.store=false] Sets the compression method to STORE.
|
|
99657
100852
|
* @param {Object} [options.zlib] Passed to [zlib]{@link https://nodejs.org/api/zlib.html#zlib_class_options}
|
|
99658
100853
|
*/
|
|
@@ -99664,6 +100859,7 @@ var Zip = function(options) {
|
|
|
99664
100859
|
options = this.options = archiverUtils.defaults(options, {
|
|
99665
100860
|
comment: '',
|
|
99666
100861
|
forceUTC: false,
|
|
100862
|
+
namePrependSlash: false,
|
|
99667
100863
|
store: false
|
|
99668
100864
|
});
|
|
99669
100865
|
|
|
@@ -103070,7 +104266,7 @@ BufferList$1.prototype._match = function (offset, search) {
|
|
|
103070
104266
|
return this.slice(offset, offset + byteLength)[m](0, byteLength)
|
|
103071
104267
|
};
|
|
103072
104268
|
} else {
|
|
103073
|
-
BufferList$1.prototype[m] = function (offset) {
|
|
104269
|
+
BufferList$1.prototype[m] = function (offset = 0) {
|
|
103074
104270
|
return this.slice(offset, offset + methods[m])[m](0)
|
|
103075
104271
|
};
|
|
103076
104272
|
}
|