tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 195 forks source link

instanceof #68

Closed nijikokun closed 11 years ago

nijikokun commented 12 years ago

instanceof is bad and you should feel bad for using it. Here at least. In the other places... it's more suited because you implicitly state it's instanceof but here it really isn't.

https://github.com/visionmedia/should.js/blob/master/lib/should.js#L547 https://github.com/visionmedia/should.js/blob/master/lib/should.js#L675

Object.prototype.toString.call([Object])

tj commented 12 years ago

meh I dont do cross-context stuff really so it doesn't matter to me, we could change the one to Array.isArray()

nijikokun commented 12 years ago

True, but why prefer that over a cross-compat one?

tj commented 12 years ago

should isn't built for the browser, it would fail in lots of browsers because of the getters already

nijikokun commented 12 years ago

True, I suppose then the Array.isArray() is fine unless you want strict equality.