aboutsummaryrefslogtreecommitdiff
path: root/src/assert.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/assert.ts')
-rw-r--r--src/assert.ts13
1 files changed, 13 insertions, 0 deletions
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 };