assert icon indicating copy to clipboard operation
assert copied to clipboard

allow null/non-null type checking

Open jeffbcross opened this issue 11 years ago • 0 comments

I should be able to require that a value is exactly the type I specify, and expect it to throw if given null.

var val = null;
assert.type(val, assert.string);

That assertion passes in the current implementation. It would be nice be able to indicate that a value is nullable: assert.type(val, assert.string, true);

Or if we wanted to extend the language to support this: assert.type(?val, assert.string); or non-nullable: assert.type(!val, assert.string);.

jeffbcross avatar Apr 15 '14 18:04 jeffbcross