From 3d17e2333857f00c0cfd836179ebf8c86dd2c489 Mon Sep 17 00:00:00 2001 From: David Braun Date: Sat, 6 Apr 2019 09:29:12 -0400 Subject: [PATCH] Stop `map` from returning buffered channels. --- lib/index.js | 4 ++-- test/index.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index ac6e97b..ca3913d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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; diff --git a/test/index.js b/test/index.js index b46ee81..8ae24c7 100644 --- a/test/index.js +++ b/test/index.js @@ -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`]); });