about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-03-03 11:37:39 -0500
committerelioat <hi@eli.li>2023-03-03 11:37:39 -0500
commitd31b4c86cbb98d027472a20f4d573281e9c0cf26 (patch)
tree4be8843c2c10dcb817cd1ac127deca5e086639d7
parent948473e7899cfdfb30b62b608a04d94041d2c727 (diff)
downloadtour-d31b4c86cbb98d027472a20f4d573281e9c0cf26.tar.gz
*
-rw-r--r--lisp/js/lisp.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/js/lisp.js b/lisp/js/lisp.js
index 06e18e5..ee2b88d 100644
--- a/lisp/js/lisp.js
+++ b/lisp/js/lisp.js
@@ -222,6 +222,12 @@
       return a === b;
     },
 
+    assert: (condition, message) => {
+      if (!condition) {
+          throw new Error(message || 'Assertion failed');
+      }
+    },
+
     benchmark: async (fn) => { // logs time taken to execute a function.
       const start = Date.now();
       const result = await fn();