diff --git a/src/module/utils.ts b/src/module/utils.ts index 668a9bf..a3038fe 100644 --- a/src/module/utils.ts +++ b/src/module/utils.ts @@ -4,6 +4,14 @@ import { getGameSafe } from "./helpers"; +/** + * Tests if the given `value` is truthy. + * + * If it is not truthy, an {@link Error} is thrown, which depends on the given `message` parameter: + * - If `message` is a string`, it is used to construct a new {@link Error} which then is thrown. + * - If `message` is an instance of {@link Error}, it is thrown. + * - If `message` is `undefined`, an {@link Error} with a default message is thrown. + */ export function enforce(value: unknown, message?: string | Error): asserts value { if (!value) { if (!message) {