(cb: Function)
| 14 | * Execute a block of code ignoring any exceptions. |
| 15 | */ |
| 16 | export function swallowExceptions(cb: Function): void { |
| 17 | try { |
| 18 | const result = cb(); |
| 19 | if (isPromise(result)) { |
| 20 | result.catch(noop); |
| 21 | } |
| 22 | } catch { |
| 23 | // Ignore errors. |
| 24 | } |
| 25 | } |
| 26 | /** |
| 27 | * Like `Readonly<>`, but recursive. |
| 28 | * |