Skip to content

Commit

Permalink
Update lib/internal/streams/duplexify.js
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
ronag and aduh95 committed Jul 26, 2021
1 parent 7904fb0 commit cf96032
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/internal/streams/duplexify.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,19 @@ module.exports = function duplexify(body, name) {
});
}

if (typeof value?.then === 'function') {
const { then } = value;
if (typeof then === 'function') {
let d;

const promise = PromiseResolve(value)
.then((val) => {
const promise = FunctionPrototypeCall(then, value,
(val) => {
if (val != null) {
throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val);
}
})
.catch((err) => {
},
(err) => {
destroyer(d, err);
});
}));

return d = new Duplex({
objectMode: true,
Expand Down

0 comments on commit cf96032

Please sign in to comment.