export function nullIfUndefined(value: T | undefined): T | null { return value === undefined ? null : value; } export function throwIfFalsy(value: any, name: string = '') { if (!value) { throw new Error(name + ' is falsy.'); } }