13 lines
407 B
JavaScript
13 lines
407 B
JavaScript
|
var _ = require('underscore');
|
||
|
|
||
|
module.exports = function checkAndBuildRequiredOpts (actualOpts, requiredOpts, context) {
|
||
|
if (requiredOpts === void 0) {
|
||
|
throw new Error('Opts are required');
|
||
|
}
|
||
|
|
||
|
_.each(requiredOpts, function (item) {
|
||
|
if (actualOpts === void 0 || actualOpts[item] === void 0) throw new Error(item + ' is required');
|
||
|
context['_' + item] = actualOpts[item];
|
||
|
}, context);
|
||
|
};
|