(t: T | null, f: (_: T) => R)
| 31 | } |
| 32 | |
| 33 | export function nullMap<T, R>(t: T | null, f: (_: T) => R): R | null { |
| 34 | if (t === null) { |
| 35 | return t as null |
| 36 | } |
| 37 | return f(t) |
| 38 | } |
| 39 | |
| 40 | // https://stackoverflow.com/a/65666402 |
| 41 | // If you update this function, also update `./utility.workerd.ts`! |
no outgoing calls
no test coverage detected