stream: fix `Writable` subclass instanceof checks · nodejs/node@8c4fab0 · GitHub
Skip to content

Commit 8c4fab0

Browse files
addaleaxevanlucas
authored andcommitted
stream: fix Writable subclass instanceof checks
2a4b068 introduced a regression in where checking `instanceof` would fail for `Writable` subclasses inside the subclass constructor, i.e. before `Writable()` was called. Also, calling `null instanceof Writable` or `undefined instanceof Writable` would fail due to accessing the `_writableState` property of the target object. This fixes these problems. PR-URL: #9088 Ref: #8834 (comment) Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
1 parent 7171bd6 commit 8c4fab0

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

lib/_stream_writable.js

Lines changed: 8 additions & 3 deletions

test/parallel/test-stream-inheritance.js

Lines changed: 16 additions & 0 deletions

0 commit comments

Comments
 (0)