Compose Promises with logic-gate semantics to make async programming intuitive."Forget the API, remember the logic."
Features
Complete Logic-Gate Semantics
Full set of logic gates—AND, OR, XOR, NAND, NOR, XNOR, MAJORITY—makes async flows explicit. Combine multiple Promises to express complex async logic naturally.
Extended Promise Operations
Collect all success/failure results, perform full settlement analysis, strict validation, and more—ready for demanding business scenarios.
Dual API Modes
Static class methods plus configurable factory functions adapt to any coding style—pick the approach that fits your context.
Quick Start
Install
bash
npm install promise-logic
Basic Usage
javascript
import { PromiseLogic } from 'promise-logic';
// AND logic – succeeds when all Promises succeed
const results = await PromiseLogic.and([
fetch('/api/users'),
fetch('/api/posts')
]);
// OR logic – returns the first successful Promise
const data = await PromiseLogic.or([
fetchPrimaryService(),
fetchBackupService()
]);