Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function formatName(name: string, properties: {}): string {
const string = properties[`${name}Localized`] || humanizeString(name);
return string.replace(/^Rating /, '');
}
const valueFromHeading = (node: any) => {
const children = get(node, 'children')
const slug = get(node, 'data.id')
if (Array.isArray(children)) {
return flatten(getChildValue(children))
.filter(Boolean)
.join(' ')
}
return humanize(slug)
}
}),
prefix: "runtime.services",
placeholder: "",
exampleName: "my-service",
})
const taskOutputsReference = renderTemplateStringReference({
schema: TaskRuntimeContext.getSchema().keys({
outputs: getOutputsSchema(desc, "taskOutputsSchema").required(),
}),
prefix: "runtime.tasks",
placeholder: "",
exampleName: "my-tasks",
})
const frontmatterTitle = titleize(humanize(name))
const template = handlebars.compile(readFileSync(moduleTemplatePath).toString())
return template({
frontmatterTitle,
name,
docs,
markdownReference,
yaml,
hasOutputs: moduleOutputsReference || serviceOutputsReference || taskOutputsReference,
moduleOutputsReference,
serviceOutputsReference,
taskOutputsReference,
})
}
private getName(filepath: string, parsed: ParsedData): string {
const filename = humanize(path.parse(filepath).name)
return parsed && parsed.name ? parsed.name : filename
}
filePath = path.resolve(process.cwd(), "./" + item);
return [4 /*yield*/, mdx_1.parseMdx(filePath)];
case 1:
ast = _a.sent();
metasArray = mdx_1.getMetadata(ast);
finalRoute = path.basename(item).replace(path.extname(item), '');
entries[item] = {
filepath: item
};
metasArray && metasArray.forEach(function (_a) {
var key = _a.key, value = _a.value;
if (key && value)
entries[item][key] = value;
});
entries[item] = {
name: entries[item].name || humanize_string_1.default(slugify_1.default(finalRoute)),
route: entries[item].route || "/" + slugify_1.default(finalRoute)
};
return [2 /*return*/];
}
});
}); }))];