Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bach

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bach

Compose your async functions with elegance.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
increased by0.5%
Maintainers
2
Weekly downloads
 
Created

What is bach?

The bach npm package is a tool for composing asynchronous functions in series or parallel. It is particularly useful for orchestrating tasks that need to be executed in a specific order or concurrently, often seen in build processes or complex workflows.

What are bach's main functionalities?

Series Execution

Executes tasks one after another. Each task will start only after the previous one has completed.

const { series } = require('bach');

function task1(cb) { console.log('Task 1'); cb(); }
function task2(cb) { console.log('Task 2'); cb(); }

const tasks = series(task1, task2);
tasks(function(err) { console.log('Done executing tasks in series.'); });

Parallel Execution

Executes tasks simultaneously. All tasks will start at the same time and run concurrently.

const { parallel } = require('bach');

function task1(cb) { console.log('Task 1'); cb(); }
function task2(cb) { console.log('Task 2'); cb(); }

const tasks = parallel(task1, task2);
tasks(function(err) { console.log('Done executing tasks in parallel.'); });

Settled Parallel Execution

Executes tasks in parallel and collects their results. Even if one task fails, the others will continue to execute.

const { parallel } = require('bach');

function task1(cb) { console.log('Task 1'); cb(null, 'result1'); }
function task2(cb) { console.log('Task 2'); cb(null, 'result2'); }

const tasks = parallel(task1, task2);
tasks(function(err, results) { console.log('Results:', results); });

Other packages similar to bach

Keywords

FAQs

Package last updated on 29 Aug 2022

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc