Skip to content

beckan/await-iteration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Await forEach

Asynchronous forEach function. To let you await for the forEach.

Getting Started

Install with nodeJS.

npm install await-iteration

How to use

// Import the module
import forEach from 'await-iteration';

// You need to use it inside a async function to be able to wait for it to be finish
async run () {
	// Setting up a array to iterate
	const array = [0, 1, 2, 3];

	// Wait for the forEach to iterate the array
	await forEach(array, async (value, index) => {

		// Feel free to wait for anything here
		await something(value);
	});

	// The iteration is finish
	console.log('Finish');
}

// Kick off
run();

License

Copyright (c) 2018 "Beckan" Daniel Bäckström
Licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published