Last active
January 25, 2020 07:22
-
-
Save marcosmapf/0e3b5df8162ce2c2598c134e3469fd22 to your computer and use it in GitHub Desktop.
Asynchronously fetch data from iterable structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Receives an iterable structure containing { target, options } objects and calls fetch on each | |
| Returns a Generator of Promises | |
| */ | |
| export default function* fetchFromIterable(data) { | |
| for (const { target, options = {} } of data) { | |
| yield fetch(target, options) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: