New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ql

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ql

Use logic to compose promises

0.1.5
latest
Source
npm
Version published
Maintainers
1
Created
Source

QL - Q with logic

This very simple library adds logic operators to compose promises. Operators added:

  • asyncRejectOnFirstRejected (rejects as soon as one of the input promises is rejected)
  • syncResolveOnAllResolved (rejects when all promises are completed and at least one of them is rejected)
  • not
  • asyncResolveOnFirstResolved (resolves as soon as one of the input promises is resolved.)
  • syncRejectOnAllRejected (resolves when all promises are completed and at least one of them is resolved.)

Installation:

npm install ql

Usage:

The library extends Q:

Q = require('ql');
...
p1 = myAjaxCallReturningAPromise()
p2 = myOtherCallReturningAPromise()
...
Q.asyncResolveOnFirstResolved(p1,Q.not(p2)).then(function() {
    console.log("Either p1 succeeded or p2 failed");
    })

Keywords

promises

FAQs

Package last updated on 30 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts