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 

http://jsbin.com/qugihobalu/2/edit


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -