node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org ยป



shouldbe is a type-checking utility for JavaScript code that lives write in your code and throws up if underscore says the value is not of the given type.


shouldbe("string", str) // throws if _.isString(str) would return false


Underscore is the only dependency right now.

How to add more types

Just add the relevant mixin to underscore.

For example:

    isEvenValue: function (val) { return !(val % 2); }
shouldbe("even-value", 3); // throws up!