PromiseLogic.nand()

Composite Logic GateNAND Logic - NOT AND logic, succeeds when at least one Promise fails

The PromiseLogic.nand() method implements NAND (NOT AND) logic gate semantics, succeeding when at least one Promise fails, suitable for fault tolerance detection and anomaly monitoring scenarios.

Syntax

javascript
 PromiseLogic.nand(iterable)

Parameters

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

Return Value

Returns a Promise that resolves to true when at least one Promise fails, otherwise resolves to false.

Promise<boolean>

Behavior

Success Condition

When at least one Promise fails, the returned Promise resolves to true.

Failure Condition

When all Promises succeed, the returned Promise resolves to false.

Examples

Basic Usage

NAND Logic Example - Succeeds when at least one fails

JAVASCRIPT
Loading...

Error Handling

NAND Logic Example - All Promises succeed

JAVASCRIPT
Loading...

Real Application

Fault tolerance detection

JAVASCRIPT
Loading...

Important Notes

  • NAND logic is the negation of AND logic, outputs true when at least one input is false
  • Suitable for scenarios requiring system failure or anomaly detection
  • Returns boolean value for easy conditional judgment
  • Can be used to build more complex logic judgments