Permalink
Browse files

Added ASSERT support

  • Loading branch information...
1 parent 9c1d29c commit b72e1e7936a7869adc7031b895d33c3cda925aee @tj committed Nov 30, 2011
Showing with 6 additions and 2 deletions.
  1. +3 −1 Readme.md
  2. +3 −1 lib/better-assert.js
View
4 Readme.md
@@ -9,6 +9,8 @@
## Example
+ By default assertions are disabled, so the calls to `assert()` will simply be ignored. Use the __ASSERT__ env var to enable:
+
```js
var assert = require('better-assert');
@@ -24,7 +26,7 @@ assert(user.authenticated);
outputting:
-![assertions](http://f.cl.ly/items/3Q3Q120q3b3D0F1W2K31/Screenshot.png)
+![assertions](http://f.cl.ly/items/1F1W0H0h2T0L233L352o/Screenshot.png)
## License
View
4 lib/better-assert.js
@@ -16,7 +16,9 @@ var fs = require('fs')
* Expose `assert`.
*/
-module.exports = assert;
+module.exports = process.env.ASSERT
+ ? assert
+ : function(){};
/**
* Assert the given `expr`.

0 comments on commit b72e1e7

Please sign in to comment.