Skip to content

honzabrecka/dopar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dopar

 It runs many promises in parallel.

Installation

yarn install dopar

Usage

import dopar from 'dopar'

const lazyPromises = [
  () => oneSecondDelay(),
  () => oneSecondDelay(),
  () => oneSecondDelay(),
]

dopar(3, lazyPromises) // resolves after +-1 second instead of 3 seconds
dopar.forEach(3, lazyPromises) // resolves after +-1 second instead of 3 seconds

The difference between dopar and dopar.forEach is that the latter does not store any result in memory.