Skip to content

Commit

Permalink
Added ASSERT support
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Nov 30, 2011
1 parent 9c1d29c commit b72e1e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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

Expand Down
4 changes: 3 additions & 1 deletion lib/better-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ var fs = require('fs')
* Expose `assert`.
*/

module.exports = assert;
module.exports = process.env.ASSERT
? assert
: function(){};

/**
* Assert the given `expr`.
Expand Down

0 comments on commit b72e1e7

Please sign in to comment.