mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
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:
1 parent
c32c5f0d43
commit
b9ef539eae
2 files changed
+19
-1
No files matched your search
@@ -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(() => {}));
|
||||
Reference in new issue
Block a user