Skip to content

confluxpe/asyncforeach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asyncforeach

Utility to execute an asynchronous function sequentially in forEach for an array

npm install asyncforeach_pe

🇵🇪 Spanish - Español

Usage

var asyncForEach = require('asyncforeach_pe');

(async () => {
	const testTime = () => {
		return new Promise(async (resolve, reject) => {
			setTimeout(() => {
				console.log('thinkking');
				resolve();
			}, 1500);
		});
	};

	await asyncForEach([1, 2, 3], async (item, i) => {
		console.log('Item and index', { item, i });
		await testTime();
	});
})();

About

Utility to execute an asynchronous function sequentially in forEach for an array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published