Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fragmentsForId.forEach(function(fragment) {
var doc = fragment.yaml;
if (!doc.name || !doc.component) {
log.error('Doc ' + fragment.filePath +
' expects yaml keys "name" and "component"!');
}
doc.id = doc.component + '-' + doc.name;
doc.fileType = typeTransform[fragment.fileType] || fragment.fileType;
doc.fileName = fragment.fileName;
doc.contents = fragment.contents;
doc.extension = doc.fileType.replace(/^\./,'');
doc.template = templates[doc.fileType] || 'asset.contents.template',
doc.outputPath = path.join(contentsFolder, _.template(assetOutputPath, doc));
doc = (transform[doc.fileType] || _.identity)(doc);
demoData.files.push(doc);
pages.push(doc);