Closed ducin closed 6 years ago
I totally agree that for..of
loops allow serial processing. In general, this is actually my stylistic preference. However, this library exists to serve the mindset that you either want:
I think the objection you have is the "...there's no way to do the iterations..." part. To clarify, I could either change that to "...there's no FP-style way to do the iterations..." or "...there's no way to do the FP-style iterations..." Do either of those address the concern you have?
Yep, the (FP) style is the key here. Both are ok :)
PS as for the point 2 you mentioned:
you want to do filter/etc serially
what do you mean here? I can filter/etc using for..of + manually create/mutate arrays (imperative style). I can't do that the FP way - but it falls down to point 1. Or maybe there's something I'm missing?
Sorry I think I meant concurrently
addressed in fe557d5ccf41bdd5b5aa583678fac5427844be3f
Hi @getify,
Wanted to comment on a part of the readme below:
although assumes concurrency is true for
async function
s inside ofPromise.all
, you still havefor..of
loop available which would perfectly suit iterating overusers
(let it be array or any other iterable) that, given youawait
inside the loop, make it native sequential processing.So I'm not sure if there's no way to do the iterations serially. Sure it fits
map
only - doesn't fitfilter
,reduce
- but it's worth mentioning. IMHO it's the easiest approach for sequential processing within async functions, if you justmap
items sequentially.Anyway, good work, as always! :)