Show HN: cofoja-like's contracts for Javascript - my weekend project.(github.com)
github.com
Show HN: cofoja-like's contracts for Javascript - my weekend project.
https://github.com/wbecker/jsContract/blob/master/README
https://github.com/wbecker/jsContract/blob/master/README
There are some other libraries that do the same thing for Javascript, (http://www.cerny-online.com/cerny.js/ http://weblogs.mozillazine.org/weirdal/archives/016921.html and one also called jsContract (oops - - looks like I might have to change my name...) http://kinsey.no/projects/jsContract/)
The difference with these is they all expect you to call a special library within your functions. My library takes the cofoja approach, where you keep your function the same, but wrap it up with annotations that specify the contracts. You can even turn contracts off completely, by setting a variable.
It has some tests there, but they aren't in jsUnit - I'll do that tomorrow. My next step is to put contracts on each of its own functions, just to prove it works.