import { EnumError } from './const'; export function assert(condition: boolean, message?: string): void { if (!condition) { throw new Error(message || EnumError.AssertionError) } } export function last(xs: T[]): T | undefined { return xs.length === 0 ? undefined : xs[xs.length - 1] }