From 52b9437f51ab0178c92042a152e784ccdc68aeb0 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 10 Aug 2026 13:59:47 +0200 Subject: add assert depending on the build mode --- src/assert.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/assert.ts (limited to 'src/assert.ts') diff --git a/src/assert.ts b/src/assert.ts new file mode 100644 index 0000000..5589895 --- /dev/null +++ b/src/assert.ts @@ -0,0 +1,13 @@ +const isProduction = process.env.NODE_ENV === "production"; + +let assert: (cond: boolean, msg: string) => void; + +if (isProduction) { + assert = function (cond: boolean, msg: string) { + console.assert(cond, msg); + }; +} else { + assert = function (_cond: boolean, _msg: string) {}; +} + +export { assert }; -- cgit v1.2.3