UNPKG

@msom/common

Version:

@msom/common

12 lines (11 loc) 289 B
export function assert( condition: unknown, message: string | (() => Error) | Error = "" ): asserts condition { if (!condition) { if (typeof message === "function") { throw message(); } throw typeof message === "string" ? Error(message) : message; } }