Check if passed parameter is Backbone.js view or command.
I'm passing a Backbone view into another as a parameter.
I need to test whether the passed function is a View and not a function of another type like a command for example.
What I came up with so far is something like this:
//content is the passed function
if (typeof content === 'function') {
//do foo
}
This condition is true when you pass a function, which is true for both, commands and views.
So I need something like this:
if(view) {
//do foo
} else if(command) {
//do bar
}
Are there any unique attributes to Backbone views which I could check against?
Thank you!