Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beckan/await-iteration
https://github.com/beckan/await-iteration
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/beckan/await-iteration
- Owner: beckan
- License: mit
- Created: 2018-11-06T06:00:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-07T06:34:08.000Z (about 6 years ago)
- Last Synced: 2024-10-02T09:13:15.180Z (4 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# JavaScript Await forEach
Asynchronous forEach function. To let you await for the forEach.
## Getting Started
Install with nodeJS.
```console
npm install await-iteration
```## How to use
```javascript
// 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.