diff options
author | elioat <hi@eli.li> | 2023-03-03 11:37:39 -0500 |
---|---|---|
committer | elioat <hi@eli.li> | 2023-03-03 11:37:39 -0500 |
commit | d31b4c86cbb98d027472a20f4d573281e9c0cf26 (patch) | |
tree | 4be8843c2c10dcb817cd1ac127deca5e086639d7 | |
parent | 948473e7899cfdfb30b62b608a04d94041d2c727 (diff) | |
download | tour-d31b4c86cbb98d027472a20f4d573281e9c0cf26.tar.gz |
*
-rw-r--r-- | lisp/js/lisp.js | 6 |
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(); |