Skip to content

MichaelKreil/work-faster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

parallel-array

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published