From 558eb9f132f84bf2ed445fc97a26f7b92a652dbc Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Wed, 28 Jun 2023 17:29:16 +0200 Subject: [PATCH] fix(console): add assert function (#19635) --- ext/console/01_console.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/console/01_console.js b/ext/console/01_console.js index ddc8daf008..d5ed80a634 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -147,6 +147,12 @@ function getNoColor() { return noColor; } +function assert(cond, msg = "Assertion failed.") { + if (!cond) { + throw new AssertionError(msg); + } +} + // Don't use 'blue' not visible on cmd.exe const styles = { special: "cyan",