@creejs/commons-lang 2.1.26 → 2.1.27
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/dist/cjs/index-dev.cjs +3 -2
- package/dist/cjs/index-dev.cjs.map +1 -1
- package/dist/cjs/index-min.cjs +1 -1
- package/dist/cjs/index-min.cjs.map +1 -1
- package/dist/esm/index-dev.js +3 -2
- package/dist/esm/index-dev.js.map +1 -1
- package/dist/esm/index-min.js +1 -1
- package/dist/esm/index-min.js.map +1 -1
- package/dist/umd/index.dev.js +3 -2
- package/dist/umd/index.dev.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
- package/types/promise-utils.d.ts +2 -1
package/dist/cjs/index-dev.cjs
CHANGED
|
@@ -2050,9 +2050,10 @@ async function parallelAllSettled (tasks, maxParallel = 5) {
|
|
|
2050
2050
|
* * One task failed, it will start next task immediately, Not Wait for the bulk(maxParallel) to complete
|
|
2051
2051
|
* @param {Array<Function|Promise<any>>} tasks - Array of async functions to execute
|
|
2052
2052
|
* @param {number} [maxParallel=5] - Maximum number of tasks to run in parallel
|
|
2053
|
+
* @param {string} [failureMessage] - Error message when all tasks failed
|
|
2053
2054
|
* @returns {Promise<any>} Resolves with the result of the first successfully completed task
|
|
2054
2055
|
*/
|
|
2055
|
-
async function parallelAny (tasks, maxParallel = 5) {
|
|
2056
|
+
async function parallelAny (tasks, maxParallel = 5, failureMessage) {
|
|
2056
2057
|
assertArray(tasks, 'tasks');
|
|
2057
2058
|
assertNumber(maxParallel);
|
|
2058
2059
|
if (tasks.length === 0) {
|
|
@@ -2097,7 +2098,7 @@ async function parallelAny (tasks, maxParallel = 5) {
|
|
|
2097
2098
|
// No task left, and No successful execution, reject with errors
|
|
2098
2099
|
if (errors.length >= tasks.length) {
|
|
2099
2100
|
if (deferred.pending) {
|
|
2100
|
-
deferred.reject(new AggregatedError('All Tasks Failed', errors));
|
|
2101
|
+
deferred.reject(new AggregatedError(failureMessage ?? 'All Tasks Failed', errors));
|
|
2101
2102
|
return
|
|
2102
2103
|
}
|
|
2103
2104
|
}
|