async-iteration-buffer
A buffering tool for async iteration.
; { let buffer = ; // Insert a sequence of iteration results into the buffer buffernext1; buffernext2; buffernext3; buffer; // Pull the values out of the buffer by iterating over it for { console; }}
Install
npm install async-iteration-buffer
API
new AsyncIterationBuffer()
Creates a new buffer instance.
buffer.next(value)
Pushes a value into the iteration buffer.
buffer.throw(error)
Pushes an exception into the iteration buffer.
buffer.return(value)
Pushes a done
result into the iteration buffer.
AsyncIterationBuffer.of(...values)
Creates a buffer pre-filled with the specified values