Socket
Book a DemoInstallSign in
Socket

debug-assert

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debug-assert

Set of assertions which work if DEBUG_ASSERT environment variable is set.

latest
Source
npmnpm
Version
0.2.3
Version published
Maintainers
1
Created
Source

What is this.

This is an assertion library, like built in node.js assert module, but:

  • Prints the whole source string containing assertion (like https://www.npmjs.com/package/better-assert).
  • Contains much more checks. We are going to support many checks from https://www.npmjs.com/package/validator.
  • Allows to print messages for passed assertions, using DEBUG_ASSERT_LOG_PASSED env var.

Installation

npm i debug-assert [-S]

Usage

Tests

Conditional assertions.

You can use require(debug-assert).conditional object to create conditional assertions which work when you set DEBUG_ASSERT env var to some non empty value.

Tests conditional

Logging passed assertions

  • Set DEBUG_ASSERT_LOG_PASSED env var to some non empty value.
  • Use setLogger() method to set some logger (like winston) and silly level will be used for passed assertions.
  • If no logger is set, logs will be printed by console.log().

Known Issues

  • If assertion consists of many strings, only the first one will be printed.
  • DEBUG_ASSERT env var is checked only at first require call.

License

MIT

Keywords

conditional

FAQs

Package last updated on 16 Mar 2018

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.