Skip to content

Instantly share code, notes, and snippets.

@marcusoftnet
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusoftnet/8768076 to your computer and use it in GitHub Desktop.
Save marcusoftnet/8768076 to your computer and use it in GitHub Desktop.
should to check for null
var should = require("should");
var myObject = null;
// DON’T
// this will fail with a "TypeError: Cannot read property 'should' of null" error
myObject.should.exsist();
// DO
// this is the proper way of writing an assertion for null
should.not.exists(myObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment