Socket
Socket
Sign inDemoInstall

in-series

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    in-series

Clean api for performing functions in series


Version published
Weekly downloads
3
Maintainers
1
Created
Weekly downloads
 

Readme

Source

in-series

This module provides a clean api for performing synchronous and asynchronous functions in series.

Install

npm i in-series --save

Example

Suppose you can only make on request at a time.

const Series = require('in-series');
const http = require('superagent');

const series = new Series;

series.push(next => {
  http
  .get('http://randomuser.me/api/')
  .end((err, user) => {
    if (err) {
      next(err)
    } else {
      next(null, user);
    }
  })
});

series.push(next => {
  http
  .get('http://randomuser.me/api/')
  .end((err, user) => {
    if (err) {
      next(err)
    } else {
      next(null, user);
    }
  })
});

series.end((err, users) => {
  // handle error, or do stuff with users
});

License

MIT

FAQs

Last updated on 23 Apr 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc