PromiseLogic.allFulfilled()

Extended FeatureGet all successful results, always returns a successful result array

The PromiseLogic.allFulfilled() method is used to get results from all successful Promises, regardless of how many Promises fail, it always returns a successful result array.

This method is particularly suitable for applications that need to gracefully handle partial failure scenarios, such as batch data loading, service health checks, fault-tolerant system design, etc.

Syntax

javascript
 PromiseLogic.allFulfilled(iterable)

Parameters

ParameterTypeDescription
iterableIterable<Promise<T>>An iterable collection of Promise objects

Return Value

Always returns a Promise that resolves to an array of values from all successful Promises (may be empty).

Promise<T[]>

Behavior

Success Condition

Waits for all Promises to complete, then returns an array of values from all successful Promises.

Special Case

The allFulfilled method never fails, even if all Promises fail it will return an empty array.

Examples

Basic Usage

Get all successful operation results

JAVASCRIPT
Loading...

Batch Operation Analysis

Analyze batch operation execution

JAVASCRIPT
Loading...

Fault-Tolerant Data Processing

Gracefully handle partially failed data loading

JAVASCRIPT
Loading...

Difference from allSettled

Key Differences

allFulfilled

  • • Only returns successful results
  • • Return type: T[]
  • • Does not contain failure information
  • • Suitable for scenarios that only need successful data

allSettled

  • • Returns status of all operations
  • • Return type: PromiseSettledResult<T>[]
  • • Contains success and failure information
  • • Suitable for scenarios requiring complete status analysis

Important Notes

  • allFulfilled always returns successful results, even if all Promises fail it returns an empty array
  • Suitable for scenarios where you need to get successful results without caring about failures
  • Can be combined with other logic gates to build more complex control flows
  • Returned array only contains values from successful Promises, no failure information