2019-07-03 15:51:48 +02:00

14 lines
270 B
JavaScript

"use strict";
function mandatory(paramName) {
throw new Error(`Missing parameter: ${paramName}`);
}
async function foo({ a, b = mandatory("b") } = {}) {
return Promise.resolve(b);
}
return foo().then(() => {
throw new Error('should not occur');
}, () => true);