Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let checkRequired = function(req) {
if (nullAsUndefined) {
validate('if (%s == undefined) {', genobj(dataSym, req));
} else {
validate('if (%s === undefined) {', genobj(dataSym, req));
}
let reqSchema = genobj(nodeSym, 'properties') + ' ? ' + genobj(genobj(nodeSym, 'properties'), req) + ' : undefined'; // eslint-disable-line max-len
error(messages.IS_REQUIRED, genobj(name, req), undefined, reqSchema);
validate('missing++');
validate('}');
};
validate('if ((%s)) {', type !== 'object' ? types.object(dataSym) : 'true');
let checkRequired = function(req) {
if (nullAsUndefined) {
validate('if (%s == undefined) {', genobj(dataSym, req));
} else {
validate('if (%s === undefined) {', genobj(dataSym, req));
}
let reqSchema = genobj(nodeSym, 'properties') + ' ? ' + genobj(genobj(nodeSym, 'properties'), req) + ' : undefined'; // eslint-disable-line max-len
error(messages.IS_REQUIRED, genobj(name, req), undefined, reqSchema);
validate('missing++');
validate('}');
};
validate('if ((%s)) {', type !== 'object' ? types.object(dataSym) : 'true');
let checkRequired = function(req) {
if (nullAsUndefined) {
validate('if (%s == undefined) {', genobj(dataSym, req));
} else {
validate('if (%s === undefined) {', genobj(dataSym, req));
}
let reqSchema = genobj(nodeSym, 'properties') + ' ? ' + genobj(genobj(nodeSym, 'properties'), req) + ' : undefined'; // eslint-disable-line max-len
error(messages.IS_REQUIRED, genobj(name, req), undefined, reqSchema);
validate('missing++');
validate('}');
};
validate('if ((%s)) {', type !== 'object' ? types.object(dataSym) : 'true');
forEach(function (e, f) {
var def = f.options && f.options.default
var resolved = resolve(f.type, m.id, false)
var vals = resolved && resolved.values
if (vals) { // is enum
if (f.repeated) {
objectKeys.push(genobj.property(f.name) + ': []')
} else {
def = (def && vals[def]) ? vals[def].value : vals[Object.keys(vals)[0]].value
objectKeys.push(genobj.property(f.name) + ': ' + parseInt(def || 0, 10))
}
return
}
objectKeys.push(genobj.property(f.name) + ': ' + defaultValue(f, def))
})
}
let exists = function(k) {
return genobj(dataSym, k) + ' !== undefined';
};
if (Array.isArray(deps)) {
validate(
'if (%s !== undefined && !(%s)) {',
genobj(dataSym, key), deps.map(exists).join(' && ') || 'true'
);
error(messages.DEPENDENCIES_NOT_SET);
validate('}');
}
if (typeof deps === 'object') {
validate('if (%s !== undefined) {', genobj(dataSym, key));
visit(name, dataSym, deps, reporter, filter);
validate('}');
}
});
Object.keys(properties).forEach(function(p) {
visit(genobj(name, p), genobj(dataSym, p), properties[p], reporter, filter);
});
}
let exists = function(k) {
return genobj(dataSym, k) + ' !== undefined';
};