In certain implementations of whatwg streams, I've come across them not implementing toString
or Symbol.toStringTag
on the prototype meaning that if you're trying to find out if you've been given a stream (or another data type) then you have to rely on duck typing.
In the following, I'd expect to see "[object ReadableStream]"
returned:
let r = new ReadableStream()
// ReadableStream {}
r.toString()
// "[object Object]"
> Object.prototype.toString.call(r)
// "[object Object]"
In Safari these all return as I'd expect, in Chrome and Firefox they return "[object Object]"
. The spec doesn't actually specify the toString behavior.