map: Return a buffered channel if appropriate.

This commit is contained in:
David Braun 2018-02-20 14:20:34 -05:00
parent e8c27056de
commit 4a4a2db7ed
2 changed files with 10 additions and 7 deletions

View file

@ -178,7 +178,8 @@ const Channel = function(length = 0) {
},
map: (callbackfn, thisArg) => {
const output = Channel();
const output = Channel(length);
(async () => {
await readOnly.forEach(value => {
output.push(callbackfn.call(thisArg, value));