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

allow null/non-null type checking #3

Open

Description

@jeffbcross

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions