@hyperledger/cactus-common
Version:
Universal library used by both front end and back end components of Cactus. Aims to be a developer swiss army knife.
20 lines (19 loc) • 911 B
TypeScript
export declare class Checks {
/**
* Verifies that a boolean condition is met or throws an Error if it is not.
*
* @param checkResult Determines the outcome of the check via it's truthyness.
* @param subjectOfCheck The error message if `checkResult` is falsy.
* @param code The code of the error if `checkResult is falsy.
*/
static truthy(checkResult: unknown, subjectOfCheck?: string, code?: string): void;
/**
* Verifies that a string is indeed not a blank string.
* Blank string can be one that only has whitespace characters for example.
*
* @param value The value that will be asserted for being a non-blank string.
* @param subject The error message if `value` is a blank string.
* @param code The code of the error if `checkResult is falsy.
*/
static nonBlankString(value: unknown, subject?: string, code?: string): void;
}