Guest User

Untitled

a guest
Dec 12th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. function* batches(volume, batchSize) {
  2. let parts = Math.ceil(volume / batchSize)
  3. for (let i = 0; i < parts; i++) {
  4. yield { value: Math.min(volume, batchSize), index: i }
  5. volume -= batchSize
  6. }
  7. }
Add Comment
Please, Sign In to add comment