PromiseLogic.xnor()

Composite Logic GateXNOR Logic - Exclusive NOR logic, succeeds when number of successful Promises is even

The PromiseLogic.xnor() method implements XNOR (exclusive NOR) logic gate semantics, succeeding when the number of successful Promises is even, suitable for symmetry checking and load balancing verification scenarios.

Syntax

javascript
 PromiseLogic.xnor(iterable)

Parameters

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

Return Value

Returns a Promise that resolves to true when the number of successful Promises is even, otherwise resolves to false.

Promise<boolean>

Behavior

Success Condition

When the number of successful Promises is even, returned Promise resolves to true.

Failure Condition

When the number of successful Promises is odd, returned Promise resolves to false.

Examples

Basic Usage

XNOR Logic Example - Succeeds when even number succeed

JAVASCRIPT
Loading...

Error Handling

XNOR Logic Example - Odd number succeed

JAVASCRIPT
Loading...

Real Application

Load balancing check

JAVASCRIPT
Loading...

Important Notes

  • XNOR logic is negation of XOR logic, outputs true when number of successes is even
  • Suitable for scenarios requiring parity checking, symmetry verification, or load balancing
  • Returns boolean value for easy symmetry verification
  • Can be used to build complex symmetry checking logic