Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildSplit(templateData, options) {
var additionalOptions = {
helper: path.join(__dirname, 'helpers.js'),
partial: path.join(__dirname, 'partials/*.hbs')
};
// Create main index file
return dmd.async(templateData, Object.assign({}, options, additionalOptions, {
data: templateData,
template: '# cwlogs-writable ' + (includeProtected ? 'Extended API' : 'API') + '\n\n{{>main-index}}'
}))
.then(function(output) {
return new Promise(function(resolve, reject) {
fs.writeFile(path.join(outputPath, 'README.md'), output, function(err) {
if (err) {
reject(err);
}
else {
resolve();
}
});
});
})
.then(function() {
.then(function(templateREADME) {
// Create project README
return dmd.async(templateData, Object.assign({}, options, additionalOptions, {
data: templateData,
template: templateREADME
}))
})
.then(function(output) {
return this.getTemplateData(options).then(function (templateData) {
return dmd.async(templateData, dmdOptions);
});
}
value: function render(options) {
options = options || {};
var dmdOptions = new DmdOptions(options);
if (options.data) {
return dmd.async(options.data, dmdOptions);
} else {
return this.getTemplateData(options).then(function (templateData) {
return dmd.async(templateData, dmdOptions);
});
}
}
}, {
.map(async ([filename, contents]) => {
if (filename === "orphans.md") {
log.warn("Orphans found!");
contents.forEach(item => log.warn(item.longname, item.meta && `${item.meta.filename}:${item.meta.lineno}`));
}
contents.fullIndex = index;
const output = await dmd.async(contents, {
...options,
"member-index-format": "list"
});
return new Vinyl({
path: filename,
contents: Buffer.from(output)
});
})
.catch((err) => {
render (options) {
options = options || {}
const dmdOptions = new DmdOptions(options)
if (options.data) {
return dmd.async(options.data, dmdOptions)
} else {
return this.getTemplateData(options)
.then(templateData => dmd.async(templateData, dmdOptions))
}
}
function buildUnified(templateData, options) {
return dmd.async(templateData, Object.assign({}, options, {
'param-list-format': 'list',
data: templateData
}))
.then(function(output) {
return new Promise(function(resolve, reject) {
fs.writeFile(outputPath, output, function(err) {
if (err) {
reject(err);
}
else {
resolve();
}
});
});
});
}
.then(templateData => dmd.async(templateData, dmdOptions))
}