export function ifPresent(value: T, fn: (v: NonNullable) => R): R | undefined { return value ? fn(value) : undefined; }