typedjs

Dynamic type checking for JavaScript

node-typedjs

This is the TypedJS module for node.js

TypedJS lets you annotate your JavaScript functions with Haskell-like type signatures and then runs a set of automated tests against those functions.

For more information visit the TypedJS GitHub repo

In your project

npm install typedjs

Globally to check all your projects

npm install typedjs -g
var typedjs = require('typedjs');
typedjs.addTest('foo :: Number -> Number', function foo(n) {
  return n;
});
typedjs.runTests(); // will output to console.log

You can also use a callback if you prefer

typedjs.runTests(function (data) {
  // the data that would've been passed to console.log
  // is sent here instead.
});
var typedjs = require('typedjs');
var path = require('path');
typedjs.runTests(path.join(__dirname, 'myFile.js'), function (data) {
  // this is an optional callback
  // data will be sent to console.log by default.
});
$ typedjs your_file.js

MIT-LICENSE