| 1 |
"use strict"; |
| 2 |
|
| 3 |
function mandatory(paramName) { |
| 4 |
throw new Error(`Missing parameter: ${paramName}`); |
| 5 |
} |
| 6 |
|
| 7 |
async function foo({ a, b = mandatory("b") } = {}) { |
| 8 |
return Promise.resolve(b); |
| 9 |
} |
| 10 |
|
| 11 |
return foo().then(() => { |
| 12 |
throw new Error('should not occur'); |
| 13 |
}, () => true); |