tj / should.js

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

Proposing a fallback of `.instanceof` as `.instanceOf` #55

Closed gabrielfalcao closed 12 years ago

gabrielfalcao commented 12 years ago

I've checked #47 and I totally agree with the fact that .instanceof is ok to be used even though it's a reserved keyword.

But it turns out that I have a particular example of when that fallback would help

  1. Emacs running jshint

http://f.cl.ly/items/040b2x1A3r060R1a011P/Screen%20Shot%202012-03-29%20at%2012.44.12%20AM.png

  1. jshint output

http://f.cl.ly/items/1c0N1s0V3M0i3G1R3i01/Screen%20Shot%202012-03-29%20at%2012.44.51%20AM.png

As a side note, I'm sorry if the implementation is not optimal. I love javascript and I'm in the learning process, so I'm not very fluent yet.

But at least I tried to add appropriate test coverage :)

Last but not least, I was also going to propose a change in package.json in order to support the conventional npm test, but when I tried that mocha did not produce any output. I was wondering what's the reason.

PS.: an honor to send a patch to you :raised_hands:

ruby0x1 commented 12 years ago

I agree with these keywords being used as properties. I run should.js outside of v8 - and often these small things blow up.

For example : get with() , get true() get false() and instanceof: function() are all flags. The newer versions of all engines that i can see - allow this as getters (and function declarations) but even just slightly older versions of JavascriptCore and spiderMonkey hate on it.