summaryrefslogtreecommitdiff
path: root/ext/console/01_console.js
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-06-28 17:29:16 +0200
committerGitHub <noreply@github.com>2023-06-28 17:29:16 +0200
commit558eb9f132f84bf2ed445fc97a26f7b92a652dbc (patch)
tree74a5b5394c40f2a92f7b3205e84a0d3a23a704cb /ext/console/01_console.js
parentd82b5f3beca588d050784ff191aae5698ff5c61e (diff)
fix(console): add assert function (#19635)
Diffstat (limited to 'ext/console/01_console.js')
-rw-r--r--ext/console/01_console.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js
index ddc8daf00..d5ed80a63 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",