Open sindresorhus opened 6 years ago
hey @sindresorhus, I will try to implement this. However, I have some doubts:
transform
callback entirely or should we have support for both?output
argument to iterator's next()
, unless we specify the property value
returned by next()
should be a function just like transform
. What do you think?.write()
or just call next()
once?unhook()
as soon as the iterator's reaches its end?ping @sindresorhus
Thanks for your patience :)
Is the async iterator supposed to replace the transform callback entirely or should we have support for both?
My thinking is that it's just an addition for when you only need to read and not transform.
We cannot pass the output argument to iterator's next(), unless we specify the property value returned by next() should be a function just like transform. What do you think?
We could support transform by returning a function that accepts the new value, indeed, but I think this would be more complicated for the user than just using the existing transform callback, so I think it makes more sense to only support the read-only case.
Is the idea to loop through the iterator until its end per call to .write() or just call next() once?
Per call to .write()
Shall we call unhook() as soon as the iterator's reaches its end?
Yes
@sindresorhus no worries 😄
Thanks for the feedback. As soon as I have some free time, I'll work on this. 💪
Could be a nice alternative to the
transform
callback.