PromiseLogic.and()
Core Logic GateAND Logic - Succeeds when all Promises succeed
The PromiseLogic.and() method implements AND logic gate semantics, succeeding when all input Promises succeed. It is equivalent to standard Promise.all(), but provides more intuitive logical semantics.
Syntax
javascript PromiseLogic.and(iterable)
Parameters
| Parameter | Type | Description |
|---|---|---|
| iterable | Iterable<Promise<T>> | An iterable collection of Promise objects |
Return Value
Returns a Promise that resolves to an array of all input Promise successful values.
Promise<T[]>Behavior
Success Condition
When all input Promises resolve successfully, the returned Promise resolves to an array of all successful values.
Failure Condition
When any input Promise is rejected, the returned Promise is immediately rejected with the first rejection reason.
Examples
Basic Usage
AND Logic Example - Succeeds when all Promises succeed
JAVASCRIPT
Loading...
Error Handling
AND Logic Failure Example - Any Promise failure causes overall failure
JAVASCRIPT
Loading...
Real Application
Load multiple API data in parallel
JAVASCRIPT
Loading...
Important Notes
- • AND logic behaves exactly like standard Promise.all()
- • Any Promise failure immediately causes overall failure (short-circuit behavior)
- • Suitable for scenarios where all operations must succeed to continue
- • For scenarios where partial success is acceptable, consider using PromiseLogic.or()