-
Notifications
You must be signed in to change notification settings - Fork 1
jsContract is a framework for using code contracts in Javascript. The library is very easy to use and supports both pre- and postconditions.
oyvindkinsey/jsContract
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
jsContract is a tool for implementing code contracts in Javascript.
Code contracts are implemented as a series of statements in the head of each function supporting both pre- and postconditions.
myFunction(a,b,c) {
Contract.expectNumber(a,"a is not a number");
Contract.guaranteesString("The result was not a string");
To support postconditions one has to instrument the script (rewrite it) using a call to Contract.instrument , such as
var script = ".......";
var instrumented = Contract.instrument(script);
One can also use the Contract framework to asynchronously load and instrument files using Contract.load
Contract.load("myscript.js",true,function(){
useCode();
});
The library is shared under the MIT-license.
http://www.opensource.org/licenses/mit-license.phpAbout
jsContract is a framework for using code contracts in Javascript. The library is very easy to use and supports both pre- and postconditions.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published