@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/esm/index-dev.js
CHANGED
|
@@ -2046,9 +2046,10 @@ async function parallelAllSettled (tasks, maxParallel = 5) {
|
|
|
2046
2046
|
* * One task failed, it will start next task immediately, Not Wait for the bulk(maxParallel) to complete
|
|
2047
2047
|
* @param {Array<Function|Promise<any>>} tasks - Array of async functions to execute
|
|
2048
2048
|
* @param {number} [maxParallel=5] - Maximum number of tasks to run in parallel
|
|
2049
|
+
* @param {string} [failureMessage] - Error message when all tasks failed
|
|
2049
2050
|
* @returns {Promise<any>} Resolves with the result of the first successfully completed task
|
|
2050
2051
|
*/
|
|
2051
|
-
async function parallelAny (tasks, maxParallel = 5) {
|
|
2052
|
+
async function parallelAny (tasks, maxParallel = 5, failureMessage) {
|
|
2052
2053
|
assertArray(tasks, 'tasks');
|
|
2053
2054
|
assertNumber(maxParallel);
|
|
2054
2055
|
if (tasks.length === 0) {
|
|
@@ -2093,7 +2094,7 @@ async function parallelAny (tasks, maxParallel = 5) {
|
|
|
2093
2094
|
// No task left, and No successful execution, reject with errors
|
|
2094
2095
|
if (errors.length >= tasks.length) {
|
|
2095
2096
|
if (deferred.pending) {
|
|
2096
|
-
deferred.reject(new AggregatedError('All Tasks Failed', errors));
|
|
2097
|
+
deferred.reject(new AggregatedError(failureMessage ?? 'All Tasks Failed', errors));
|
|
2097
2098
|
return
|
|
2098
2099
|
}
|
|
2099
2100
|
}
|