assert

assert

Throws an error when the condition is not true.

Import

import { assert } from '@fullstacksjs/toolbox';

Signature

function assert(condition: boolean, msg: string = 'Assertion failed'): void {}

Examples

assert(false, 'WTF') // Throw 'WTF'
assert(true, 'WTF')  // noop