Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Type signatures for your javascripts

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 package.json
Octocat-spinner-32 readme.md
readme.md

sign

Type signatures for your javascripts.

Why?

Sometimes, dynamic types kinda suck. Being able to easily specify your types going in and out can help get rid of bugs due to javascript silently changing your numbers into strings or something. It's been an idea I've had kicking around, at any rate.

Usage:

Right now, I just have one example:

var sign = require("./lib/sign");

var oneup = sign("number", "number", function (n) {
  return n+1;
});

In use:

> oneup(3);
4
> oneup("three");
AssertionError: true == false

Pretty neat!

Teh Futar:

  • wildcards, ors, things like that
  • a haskell-like parser ("a -> b")
  • allow for Number, Array and Buffer in signatures instead of the string counterparts
Something went wrong with that request. Please try again.