What is the best way to determine if an object is an instance of the Stream class?
2 answers
Observable
is the base class from which objects EventStream
and Property
. Therefore, if you want to discover something bacon, you can use Observable
.
function isStream(v) {
return v instanceof Bacon.Observable
}
function test(v) {
console.log(isStream(v))
}
test(Bacon.constant(1)) // true
test(Bacon.once(1)) // true
test(1) // false
+2
source to share