cartodb/lib/assets/javascripts/builder/helpers/required-opts.js

13 lines
407 B
JavaScript
Raw Normal View History

2020-06-15 10:58:47 +08:00
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);
};