1.0.0 • Published 2 years ago

@krlwlfrt/async-pool v1.0.0

Weekly downloads
396
License
MIT
Repository
gitlab
Last release
2 years ago

@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.

1.0.0

2 years ago

0.8.0

3 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago