diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2023-06-28 17:29:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 17:29:16 +0200 |
commit | 558eb9f132f84bf2ed445fc97a26f7b92a652dbc (patch) | |
tree | 74a5b5394c40f2a92f7b3205e84a0d3a23a704cb | |
parent | d82b5f3beca588d050784ff191aae5698ff5c61e (diff) |
fix(console): add assert function (#19635)
-rw-r--r-- | ext/console/01_console.js | 6 |
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", |