Closed tshemsedinov closed 7 years ago
@tshemsedinov would you kindly update the use case, so it matches the signature provided in the topic? TIA
UPD: not need =/
@anxolerd doesn't it match?
@aqrln did not notice the initial and get lost in callback function =) Sorry)
@anxolerd np :)
@anxolerd thanks for your feedback, though. The fact that you could not read the code snippet correctly clearly indicates that the syntax may not be that great (and it indeed isn't; things that work well in non-asynchronous world may become way too complicated when asynchronous operations are being involved). This one and accompanying functions like metasync.filter
and metasync.map
will surely exist mimicking Array.prototype.*
, but we came up with an idea of much more readable and convenient alternative mechanism for applying such transformations, chainable and Promise-friendly. Stay tuned :)
What we certainly have... a confusing syntax ) I propose add alternative syntax:
metasync.for(items).reduce(fn).done(fn);
// or
metasync.for(items).reduce(fn).then(fn).catch(fn);
Well, it was a surprise to find out that reduce is already implemented. Probably the alternate chainable and promise friendly syntax should be moved to a new issue (if it does not exist), and this one should be closed in order to not confuse others...
See #37
@anxolerd see https://github.com/metarhia/MetaSync/pull/39 and an example of usage.
Use case: