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

@krlwlfrt/async-pool

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@krlwlfrt/async-pool

Async pool for iterables

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
548
increased by1.29%
Maintainers
1
Weekly downloads
 
Created
Source

@krlwlfrt/async-pool

pipeline status npm license) documentation

This is a TypeScript enabled version of tiny-async-pool.

Usage

import {asyncPool} from '@krlwlfrt/async-pool/lib/async-pool';

// can be anything that is iterable (aka implements Iterable)
const inputIterable = [100, 200, 300, 400];

/**
* Multiply input number by two
* 
* @param item Number to multiply by two
*/
async function iteratorFunction (item: number): Promise<number> {
  return item * 2;
}

// invoke async pool with limit 2 - meaning 2 iterator functions are executed simultaneously
asyncPool(2, inputIterable, iteratorFunction).then((result) => {
  console.log(result); // outputs [ 200, 400, 600, 800 ]
});

Documentation

See online documentation for detailed API description.

Keywords

FAQs

Package last updated on 25 Nov 2019

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