Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

"instanceof Array" considered harmful #5

xinaesthete opened this Issue Jul 31, 2013 · 2 comments


None yet
2 participants

Using osc-min in Node-Webkit, I've found that that there is a problem with arrays passed in as arguments (for example to toBuffer) having strange behaviour as they cross js contexts. You can follow the thread for relevant reading etc, but the long and short of it is that foo instanceof Array can be troublesome while Array.isArray(foo). rogerwang/node-webkit#921

There's a simple change that I've made to osc-min locally, which seems to work, namely changing line 550 of osc-utilities.coffee to

IsArray = (arr) -> (((typeof arr) is "object") and (Array.isArray(arr)))

russellmcc added a commit that referenced this issue Jul 31, 2013


russellmcc commented Jul 31, 2013

Good catch. That's a pretty weird case.

@russellmcc russellmcc closed this Jul 31, 2013

Interesting one, eh? Thanks for the quick turnaround & the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment