javascript - What is the best way to detect if an Object is an instance of a Stream Class? -
is there way detect if object instance of stream -class? example rxjs or bacon.js stream.
what i'm looking like
function isstream(obj) { // if obj rxjs or bacon stream return true, otherwise false }
what reliable way of doing this?
observable
base class both eventstream
, property
objects inherit from. if want detect bacon, 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
Comments
Post a Comment