Stop map from returning buffered channels.

This commit is contained in:
David Braun 2019-04-06 09:29:12 -04:00
parent b426d67411
commit 3d17e23338
No known key found for this signature in database
GPG key ID: 87EC41ADF710B7E2
2 changed files with 2 additions and 3 deletions

View file

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

View file

@ -271,7 +271,6 @@ describe(`Channel object`, function() {
await channel.push(`c`);
await channel.close();
const mapped = channel.map(value => value.toUpperCase());
assert.equal(mapped.length, channel.length);
assert.deepEqual(await mapped.values(), [`A`, `B`, `C`]);
});