{"repo":"sindresorhus/p-map","free":true,"listed":false,"github":"https://github.com/sindresorhus/p-map","clone":"git clone https://github.com/sindresorhus/p-map.git","description":"Map over promises concurrently","language":"JavaScript","stars":1507,"topics":["promise","async-functions","concurrency","mapper","nodejs","javascript","parallel","promises","async","async-await"],"license":"MIT","category":"dev-tools","readme_excerpt":"p-map Map over promises concurrently Useful when you need to run promise-returning & async functions multiple times with different inputs concurrently. This is different from Promise.all() in that you can control the concurrency and also decide whether or not to stop iterating when there's an error. Install Usage API pMap(input, mapper, options?) Returns a Promise that is fulfilled when all promises in input and the ones returned from mapper are fulfilled, or rejects if any of the promises reject. The fulfilled value is an Array of the fulfilled values returned from mapper in input order. pMapIterable(input, mapper, options?) Returns an async iterable that streams each return value from mapper in order. input Type: AsyncIterable unknown Iterable unknown Synchronous or asynchronous iterable that is iterated over concurrently, calling the mapper function for each element. Each iterated item is await 'd before the mapper is invoked so the iterable may return a Promise that resolves to an item. Asynchronous iterables (different from synchronous iterables that return Promise that resolves to an item) can be used when the next item may not be ready without waiting for an asynchronous process to complete and/or the end of the iterable may be reached after the asynchronous process completes. For example, reading from a remote queue when the queue has reached empty, or reading lines from a stream. mapper(element, index) Type: Function Expected to return a Promise or value. options Typ","default_branch":null,"files":null,"tree":[],"storefront":"/r/sindresorhus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sindresorhus/p-map/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}