New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

assert-fn

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-fn

Simple assert function

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 03 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts