|
/**
|
|
* Expose `required`
|
|
*/
|
|
|
|
module.exports = required;
|
|
|
|
/**
|
|
* Assert `prop` as requirement of `obj`
|
|
*
|
|
* @param {Object} obj
|
|
* @param {prop} prop
|
|
* @public
|
|
*/
|
|
|
|
function required (obj, prop) {
|
|
if (!obj[prop]) {
|
|
throw new Error(prop + ' is required.');
|
|
}
|
|
}
|