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

bach

Package Overview
Dependencies
Maintainers
1
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.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
821K
decreased by-43.63%
Maintainers
1
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 28 Jun 2016

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