stream: allow empty string as source of pipeline

Fixes: https://github.com/nodejs/node/issues/38721

PR-URL: https://github.com/nodejs/node/pull/38723
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Qingyu Deng authored and James M Snell committed 2021-05-20 09:46:47 -07:00
1 parent c32c5f0d43
commit b9ef539eae
2 files changed
+19 -1

No files matched your search

+1 -1
View File
@@ -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' ||
@@ -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(() => {}));