Fixes an issue where oboe would fail to correctly detect that an object was a stream.
Previously, o instanceof Object was used to do object detection. Based in the info from this StackOverflow post it's more reliable to do something like object !== null && typeof object === "object".
That's the change that this PR makes as in a TypeScript project I'm working on for some reason the isStream method returned false when reading a file from S3 and unzipping it, which returned a DuplexWrapper stream object.
I've tried to create a test case for this but couldn't quite reproduce it properly; even when I create a simple test to check if my stream object is an instanceof Object it turns out to be true. So I'm not entirely sure what's going on specific to this project that makes the streams in Node (12) not an instance of Object.
In any case, this change still fixes my issue even though I don't completely understand why a stream wouldn't be instanceof Object and the method of checking that is improved and causes no other side effects, with the full suite passing.
Maybe someone with more insights can explain what could be happening.
Fixes an issue where
oboe
would fail to correctly detect that an object was a stream.Previously,
o instanceof Object
was used to do object detection. Based in the info from this StackOverflow post it's more reliable to do something likeobject !== null && typeof object === "object"
.That's the change that this PR makes as in a TypeScript project I'm working on for some reason the
isStream
method returned false when reading a file from S3 and unzipping it, which returned aDuplexWrapper
stream object.I've tried to create a test case for this but couldn't quite reproduce it properly; even when I create a simple test to check if my stream object is an
instanceof Object
it turns out to be true. So I'm not entirely sure what's going on specific to this project that makes the streams in Node (12) not an instance ofObject
.In any case, this change still fixes my issue even though I don't completely understand why a stream wouldn't be
instanceof Object
and the method of checking that is improved and causes no other side effects, with the full suite passing.Maybe someone with more insights can explain what could be happening.