Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

allow null/non-null type checking #3

Open
jeffbcross opened this issue Apr 15, 2014 · 0 comments
Open

allow null/non-null type checking #3

jeffbcross opened this issue Apr 15, 2014 · 0 comments

Comments

@jeffbcross
Copy link

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);.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant