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

https://github.com/10xengineersqualityprogramming/assert-fn

Assert function for Node.js
https://github.com/10xengineersqualityprogramming/assert-fn

Last synced: 12 months ago
JSON representation

Assert function for Node.js

Awesome Lists containing this project

README

          

# assert-fn
A very simple alternative to the built-in `node:assert` module. All `assert-fn` does is check if the condition is not true, and if it is not true, throw an error.
The below code throws no error:
```javascript
const assert = require('assert-fn')
assert(2 + 2 === 4, "no error")
```
But this code throws an error:
```javascript
const assert = require('assert-fn')
assert(2 + 2 === 5, "error") // AssertionError: Assertion failed: error
```