Assert the type of a value.
npm install type-assertion
var assert = require('type-assertion')
assert({}, 'object')
assert([], 'object') //=> TypeError: expected object
assert('ok', 'value')
assert('', 'value') //=> TypeError: expected value
Assert that value
has the type of expected
(aliased to assert.type
).
To provide a simple way to assert types with a small footprint. Node.js' assert module is nice, but it's a bit too big when it comes to using it on the front-end.