/** * A function which can be used as a function parameter default which throws an error * if the parameter is undefined * * @param {string} [varname] - name of the variable for the output * @throws {Error} */ function isRequired (varname) { const message = varname ? `missing parameter '${varname}'` : 'missing parameter'; throw Error(message); } module.exports = isRequired;