Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function convert(program, callback) {
// define no-op callback
if (!callback) {
callback = function (err, blueprint) { }
}
// Read in the file
refparser.parse(program.input, function (err, schema) {
if (err) isMain ? halt(err) : callback(err);
// Read in aglio options
var options = {
themeTemplate: (program.themeTemplate === 'triple' || program.themeTemplate === 'index' || !program.themeTemplate) ?
path.resolve(__dirname, 'templates/' + (program.themeTemplate || 'index') + '.jade') :
themeTemplate,
themeVariables: program.themeVariables,
themeFullWidth: program.themeFullWidth,
noThemeCondense: program.noThemeCondense,
themeStyle: program.themeStyle,
locals: {
livePreview: program.server,
host: ((schema.schemes && schema.schemes.length > 0 && schema.host) ?
(schema.schemes[0] || 'https')
: 'https')
+ '://' + schema.host + (schema.basePath || '')
function parse(src, dst, config, callback) {
if (typeof src === "object") {
addAnnotation(src);
parseV2(src, dst, config, callback);
}
else {
$RefParser.parse(src, function (err, data) {
if (err) {
return callback(err);
}
try {
addAnnotation(data);
parseV2(data, dst, config, callback);
}
catch (err) {
return callback(err);
}
});
}
}