@soil/arch
Version:
Architectural constructs for web applications.
11 lines (10 loc) • 486 B
TypeScript
/**
* Ensure that a given condition is true, adding basic support for design-by-
* contract programming.
*
* When providing a function as opposed to a boolean as the first argument, the
* source code of the function will be included as part of the error message in
* case of failure, providing immediate feedback to help determine the reason
* why the assertion did not hold true.
*/
export declare function assert(assertion: boolean | (() => boolean), message?: string): void;