(value: T | undefined, msg?: string)
| 69 | } |
| 70 | |
| 71 | export function notUndefined<T>(value: T | undefined, msg?: string): T { |
| 72 | if (value === undefined) { |
| 73 | throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ''}`) |
| 74 | } else { |
| 75 | return value |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | export const approxEqual = (a: number, b: number) => Math.abs(a - b) < 1 |
| 80 |