Skip to content

stream: fix `Writable` subclass instanceof checks

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

Description of change

2a4b068a 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.

Ref: https://github.com/nodejs/node/pull/8834#issuecomment-253640692

Merge request reports

Loading