Skip to content
This repository

node module for typedjs

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 node_modules
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

node-typedjs

Build Status

TypedJS lets you annotate your JavaScript functions with Haskell-like type signatures and then transforms your code to perform type checking at run time.

Install

npm install typedjs

Usage

Transform your code

In your project

var typedjs = require('typedjs')
var fs = require('fs')
var code = fs.readFileSync('file_name.js')
var transformedCode = typedjs.transform(code)

From the CLI

typedjs file_name.js > output_file.js

Quickcheck your code

var typedjs = require('typedjs')

function addOne(n) {
  return n + 1
}

typedjs.quickcheck('Number -> Number', addOne)

Using require

You can use typedjs.require() in your node programs to transform a file and require it.

This is useful for your unit tests or your dev environments.

var typedjs = require('typedjs')
var someModule = typedjs.require('someModule')

// you can then use `someModule` just as you would if you would've imported
// it using Node's `require`
someModule.aFunction()

License

MIT-LICENSE

Something went wrong with that request. Please try again.