Skip to content

echamudi/node-console-assert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-console-assert

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

Usage

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.

const consoleAssert = require('node-console-assert');

Check more examples in test.js file.

Development

Branch Status
master Build Status

License

2019 © Ezzat Chamudi

The code is released under MIT License

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published