mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-25 22:01:21 -06:00
10 lines
298 B
TypeScript
10 lines
298 B
TypeScript
/**
|
|
* Replacement for console.assert, throws an error if condition is not met.
|
|
* @param condition 'truthy' condition
|
|
* @param error
|
|
*/
|
|
export function assert(condition: any, error?: string) {
|
|
if (!condition) {
|
|
throw new Error(`Assertion failed: ${error ?? 'check your code'}`);
|
|
}
|
|
}
|