Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "assert"

Index

Variables

Variables

Const assert

assert: (Anonymous function) = (() => {try {return (process.env.NODE_ENV !== "production" ||process.env.UMBRELLA_ASSERTS === "1");} catch (e) {}return false;})()? (test: boolean | Fn0<boolean>,msg: string | Fn0<string> = "assertion failed") => {if ((typeof test === "function" && !test()) || !test) {throw new Error(typeof msg === "function" ? msg() : msg);}}: NO_OP

Takes a test result or predicate function without args and throws error with given msg if test failed (i.e. is falsy).

remarks

The function is only enabled if process.env.NODE_ENV != "production" or if the UMBRELLA_ASSERTS env var is set to 1.

Generated using TypeDoc