Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@brocan/sequ

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brocan/sequ

Sequ is a basic queue which will execute promise-providing functions sequentially, only one-at-a-time.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

sequ

sequ is a basic queue which will execute promise-providing functions sequentially, only one-at-a-time.

Usage

const Sequ = require('@brocan/sequ');

// create a new sequ
const sequ = Sequ();

sequ.do(() => {
    return new Promise((resolve, reject) => {
        /*
         *  do something nasty
         */
    });
})
.then(result => {
    // will be executed when the previously created promise finishes execution
})
.catch(err => {
    // will be executed if the previously created promise fails
});

API

length: Number

The number of elements in the Sequ.

do(provider: () => Promise): Promise

Places the passed promise provider function into the queue. Returns a promise which is resolved when the original promise is resolved.

FAQs

Package last updated on 14 Nov 2017

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