metal-soy-critic
Version:
A metal-soy code validation utility.
15 lines (14 loc) • 602 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("./util");
const chalk = require("chalk");
function validateRenderTemplate(soyContext) {
const templateNames = soyContext.ast.body.map(node => node.id.name);
const renderFound = !!templateNames.find(name => name === 'render');
if (renderFound) {
return util_1.toResult(true);
}
return util_1.toResult(false, `Cannot find a ${chalk.yellow('.render')} template, do you have a typo?\n\n` +
util_1.joinErrors(templateNames));
}
exports.default = validateRenderTemplate;