11 lines
327 B
TypeScript
11 lines
327 B
TypeScript
|
import { getGame } from "./helpers";
|
||
|
|
||
|
export function enforce(value: unknown, message?: string | Error): asserts value {
|
||
|
if (!value) {
|
||
|
if (!message) {
|
||
|
message = getGame().i18n.localize("DS4.ErrorUnexpectedError");
|
||
|
}
|
||
|
throw message instanceof Error ? message : new Error(message);
|
||
|
}
|
||
|
}
|