Paul Krill
Editor at Large

JavaScript adds Node.js validation library

analysis
Sep 4, 20142 mins

Tcomb validation library emphasizes models as 'single source of truth' and focuses on early bug detection

Tcomb, a validation library for Node.js and browsers, is being offered as a tool for domain-driven design and runtime checking for JavaScript.

According to GitHub-based documentation, the tcomb library is geared toward the writing of complex domain models “in a breeze and with a small footprint.” It also is focused on easy debugging, the enabling of instances that are immutable by default, and encoding and decoding to and from JSON. Types of JavaScript values can be checked at runtime with a simple syntax.

“The main intent of tcomb is to provide a useful tool for domain-driven design that allows [developers] to detect bugs as early as possible,” tcomb developer Giulio Canti says. “In my book, models should be the single source of truth, and you should be able to derive as much as you can from them: type safety, validation, documentation, auto generated UIs. These are all satellite projects around tcomb that I’m gonna work on in the next weeks.”

Canti, a Web developer and a consultant at e-commerce platform provider Madai Ltd in the United Kingdom, says that the name is derived from a contraction of the words “types” and “combinators.” The library defines primitive types and combinators, a function that takes input from some types and returns a new type. When developers create an instance of tcomb, they can rely on its validity; otherwise the debugger kicks in so they can inspect the stack and quickly find out what is wrong, Canti says.

Tcomb features defaults like immutability that can make it easier to work with a system. The road map for tcomb includes exploring the autogeneration of UIs based on the technology. At this stage, the API for tcomb is stable, but Canti is seeking feedback on it from the JavaScript community. The library is being offered under an MIT License.

This story, “JavaScript adds Node.js validation library,” was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author