work-faster

0.3.4 • Public • Published

Work Faster

install

npm install work-faster

usage

forEachAsync works in the same way as forEach, but asynchronously. Example:

	require('work-faster');

	let list = [1,1,2,3,5];

	list.forEach(item => {
		doStuff(item)
	})

	await list.forEachAsync(async item => {
		await doStuffAsync(item)
	})

This will run as many callbacks in parallel as there are CPU cores. You can set a different value for maxParallel an optional second parameter:

	await list.forEachAsync(doStuff, 4);

Readme

Keywords

none

Package Sidebar

Install

npm i work-faster

Weekly Downloads

2

Version

0.3.4

License

MIT

Unpacked Size

8.41 kB

Total Files

4

Last publish

Collaborators

  • michaelkreil