debug-assert
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

What is this.

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

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

Package Sidebar

Install

npm i debug-assert

Weekly Downloads

18

Version

0.2.3

License

MIT

Unpacked Size

14 kB

Total Files

10

Last publish

Collaborators

  • dzenly