Re:Type Checking in JavaScript
by philbo on Wednesday November 06, 2013 @08:06AM
(#6682463)
I've contributed to a little JS lib [1] that takes a similar approach, but expands all of its predicates with two modifiers: a `maybe` modifier that tolerates null and undefined; and a `verify` modifier that throws if the predicate returns false. I've found it quite useful for eradicating some common boilerplate from my code.
e.g.:
[1] https://github.com/philbooth/check-types.js