npm.io
1.0.2 • Published 7 months ago

assert-fn

Licence
UNLICENSED
Version
1.0.2
Deps
2
Size
2 kB
Vulns
0
Weekly
0
Stars
1

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:

const assert = require('assert-fn')
assert(2 + 2 === 4, "no error")

But this code throws an error:

const assert = require('assert-fn')
assert(2 + 2 === 5, "error") // AssertionError: Assertion failed: error