diff --git a/lib/index.js b/lib/index.js index 8865485..0353f48 100644 --- a/lib/index.js +++ b/lib/index.js @@ -108,30 +108,16 @@ const Channel = function(length = 0) { const readOnly = Object.freeze( Object.assign(Object.create(prototype), { - concat: (...args) => { + concat: (first, ...rest) => { const output = Channel(); (async () => { await readOnly.forEach(output.push); - for (let index = 0; index < args.length; index++) { - const arg = args[index]; - - /* For some reason the following code works in Mocha but not in - Wallaby.js: - - await (Channel.isChannel(arg) - ? arg.forEach(output.push) - : output.push(arg)); - - If we use the 'if' statement below then Wallaby.js is happy. - */ - - if (Channel.isChannel(arg)) { - await arg.forEach(output.push); - } else { - await output.push(arg); - } + if (Channel.isChannel(first)) { + await first.concat(...rest).forEach(output.push); + } else { + await output.push(first); } await output.close();