PromiseLogic.nand()
Composite Logic GateNAND Logic - Succeeds when not all Promises succeed
The PromiseLogic.nand() method implements NAND (NOT AND) logic gate semantics, succeeding when not all Promises succeed. It returns a PromiseWithTimer instance which wraps native Promise and provides additional functionality.
Syntax
javascript PromiseLogic.nand(iterable)
Parameters
| Parameter | Type | Description |
|---|---|---|
| iterable | Iterable<Promise<T>> | An iterable collection of Promise objects |
Return Value
Returns a PromiseWithTimer that resolves to array of successful Promise results when not all succeed.
PromiseWithTimer<T[]>Behavior
Success Condition
When not all Promises succeed (at least one fails), PromiseWithTimer resolves to array of successful Promise results.
Failure Condition
When all Promises succeed, PromiseWithTimer is rejected.
Error Types
NAND_ERRORThrown when all Promises succeed
Examples
Basic Usage
NAND Logic Example - Succeeds when not all succeed
JAVASCRIPT
Loading...
Error Handling
NAND Logic Failure Example - All Promises succeed
JAVASCRIPT
Loading...
Timeout Control
Add timeout control with maxTimer method
JAVASCRIPT
Loading...
Real Application
Partial success detection with timeout
JAVASCRIPT
Loading...
Important Notes
- • NAND logic is negation of AND logic, succeeds when not all Promises succeed
- • Returns PromiseWithTimer which supports maxTimer() for timeout control
- • maxTimer can only detect timeout, cannot cancel Promise operation itself
- • Suitable for scenarios requiring partial success detection or failure monitoring
- • When all Promises succeed, throws NAND_ERROR
- • Returns array of successful Promise results when condition is met