diff --git a/lib/internal/streams/utils.js b/lib/internal/streams/utils.js index b6e744250799c6..62eea022685e18 100644 --- a/lib/internal/streams/utils.js +++ b/lib/internal/streams/utils.js @@ -20,7 +20,7 @@ function isStream(obj) { } function isIterable(obj, isAsync) { - if (!obj) return false; + if (obj == null) return false; if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function'; if (isAsync === false) return typeof obj[SymbolIterator] === 'function'; return typeof obj[SymbolAsyncIterator] === 'function' || diff --git a/test/parallel/test-stream-pipeline-with-empty-string.js b/test/parallel/test-stream-pipeline-with-empty-string.js new file mode 100644 index 00000000000000..8818f38e8596f2 --- /dev/null +++ b/test/parallel/test-stream-pipeline-with-empty-string.js @@ -0,0 +1,18 @@ +'use strict'; + +const common = require('../common'); +const { + pipeline, + PassThrough +} = require('stream'); + + +async function runTest() { + await pipeline( + '', + new PassThrough({ objectMode: true }), + common.mustCall(() => { }) + ); +} + +runTest().then(common.mustCall(() => {}));