Skip to content

10xEngineersQualityProgramming/assert-fn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Assert function for Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published