Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dkershner6/sequential-async-foreach
An NPM package to properly handle using async functions in a forEach fashion (unlike Native forEach). Uses proper Promises and is light and efficient.
https://github.com/dkershner6/sequential-async-foreach
npm-package react react-hooks
Last synced: 29 days ago
JSON representation
An NPM package to properly handle using async functions in a forEach fashion (unlike Native forEach). Uses proper Promises and is light and efficient.
- Host: GitHub
- URL: https://github.com/dkershner6/sequential-async-foreach
- Owner: dkershner6
- License: apache-2.0
- Created: 2020-07-24T16:59:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T00:20:01.000Z (7 months ago)
- Last Synced: 2024-04-14T00:24:43.437Z (7 months ago)
- Topics: npm-package, react, react-hooks
- Language: TypeScript
- Homepage:
- Size: 299 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# sequential-async-foreach
First and foremost, nearly all credit should go to Sebastian Chopin and [his fine article on this topic](https://codeburst.io/javascript-async-await-with-foreach-b6ba62bbf404).
I just used this function so frequently, that I needed ready access to it.
## Usage
```typescript
import { asyncForEach } from 'sequential-async-foreach';await asyncForEach([1, 2, 3], async (number) => {
await doTheAsyncThings(number);
});
```Each task (1, 2, and 3) will happen in order, and 2 will not start executing until the conclusion of 1.
## Contributing
All contributions are welcome, please open an issue or pull request.
To use this repository:
1. `npm i -g pnpm` (if don't have pnpm installed)
2. `pnpm i`
3. `npx projen` (this will ensure everything is setup correctly, and you can run this command at any time)
4. Good to make your changes!
5. You can run `npx projen build` at any time to build the project.