![]() Promise.each resolves with an array as explained above, while Promise.mapSeries resolves with an array containing the outputs of the iterator function on each step. The difference between Promise.each and Promise.mapSeries is their resolution value. Promise.each is very similar to Promise.mapSeries. If all iterations resolve successfully, the Promise.each call resolves to a new array containing the resolved values of the original input elements. The current element of the iteration is a rejected promise, the iteration will stop and be rejected as well (with the same reason). ![]() The current element of the iteration is a pending promise, that promise will be awaited before running the iterator. The iterator returns a promise or a thenable, it is awaited before continuing to the next iteration. The iterator function has signature (value, index, arrayLength) where value is the current element (or its resolved value if it is a promise). If an element is a promise, the iterator will wait for it before proceeding. Given an Iterable (an array, for example), or a promise of an Iterable, iterates serially over all the values in it, executing the given iterator on each element. each ( Iterable | Promise > input, function ( any value, int index, int arrayLength ) iterator ) -> Promise > ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |