diff options
Diffstat (limited to 'lisp/js')
-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(); |