Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/echamudi/node-console-assert

console.assert polyfill for node environment, make it work like browser's console.assert
https://github.com/echamudi/node-console-assert

Last synced: 4 days ago
JSON representation

console.assert polyfill for node environment, make it work like browser's console.assert

Awesome Lists containing this project

README

        

# node-console-assert

console.assert polyfill for node environment, make it work like browser's console.assert

## Usage

```js
console.assert = require('node-console-assert');

console.assert(1 + 2 === 3, '1 + 2 must equal 3'); // no error

function addition(a, b) {
return a * b;
};
console.assert(addition(2, 3) === 5, '2 + 3 must equal 5'); // error
```

If you don't want to modify the global console.assert, you can assign to a new constant.
```js
const consoleAssert = require('node-console-assert');
```

Check more examples in [test.js](https://github.com/echamudi/node-console-assert/blob/master/test.js) file.

## Development

| Branch | Status |
| - | - |
| master | [![Build Status](https://travis-ci.org/echamudi/node-console-assert.svg?branch=master)](https://travis-ci.org/echamudi/node-console-assert) |

## License

2019 © [Ezzat Chamudi](https://github.com/echamudi)

The code is released under [MIT License](https://opensource.org/licenses/MIT)