The tcomb library seems to do quite a lot, some of which might be sort of useful, but the example supplied here doesn't really seem to support why you might use it. The code in fact just seems weird to me: if you're having to use a try/catch to do some really basic form validation, then obviously that's horribly wrong... but the example below, under "Further Reading", which is (I think?) proposed as the better solution, doesn't really seem any different from how you might go about solving this problem were you not to use any library at all, except you wouldn't have the struct stuff. Very unconvincing, if you ask me.<p>Contracts.js is quite a different approach, maybe even to an orthogonal problem, but perhaps is more interesting: <a href="https://github.com/disnet/contracts.js" rel="nofollow">https://github.com/disnet/contracts.js</a>