defined value
const value1 = undefined;
const value2 = 'validString';
const defaultString = 'defaultString';
const param = 'stringParam';
validateDefined(value1, param, defaultString); // 'defaultString'
validateDefined(value1, param, undefined); // Error: stringParam undefined
validateDefined(value2, param, defaultString); // 'validString'
validateDefined(value2, param, undefined); // 'validString'
If value is undefined, it returns the defaultValue, or throws an exception. Else returns the not-undefined value.