Skip to content

kristoferbaxter/async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async Utilities

This project contains utilities one might use for Async work in ES2015 and later.

Pool

Utility that completes as many simultaneous Promise resolutions as concurrency is defined. If you have expensive operations that do not need a stable result order for completion, then this utility is for you.

async function pool<R, T>(
  items: Array<R>,
  iteratorFn: (item: R, items: Array<R>) => T,
  concurrency: number = cpus().length,
): Promise<Array<T>> {}

Passing an Array<R> of items, and an interator function that executes an expensive operation resulting in T will happen concurrently as determined by concurrency.

About

Async Utilities for Module Node Development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published