-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add checkOpen
option
#20
Conversation
return isStream(stream) | ||
&& stream.writable !== false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a default you would have chosen if you made this package from scratch today? |
Probably not. The better behavior would probably be for I wanted to avoid any breaking change, but I was also suggesting making a major release with #21, for safety, so I could change the default value if you want? If you'd want to do a major release, I can also do a PR to update the supported Node.js range. Line 16 in 45e90c2
|
Yeah, then lets change the default.
I can handle that when releasing 👍 |
There is one catch though. The
However, those inherit all from a base class
Unfortunately, that base class does not define any So technically, one could inherit from this undocumented base class and miss those properties. But then the |
I thought of a solution to support the above edge case: if |
I implemented the solution above: ready for review 👍 |
Fixes #7.
The methods in this package check two different things:
There are times when one would want to check only
1.
but not2.
. For example:finished()
,.pipe()
, etc.) work fine with closed streams.1.
and2.
This PR adds a
checkOpen
boolean option to toggle off that specific check.By default, it is
false
forisStream()
andtrue
for the others to keep backward compatibility. I.e. this is not a breaking change.