joytpl
Version:
joy - js template engine with short syntax and modern features
26 lines (18 loc) • 610 B
JavaScript
function call(arr, node, exported, options) {
arr.forEach(fn => fn(node, exported, options));
}
function extract(node, exported, options) {
const type = node.type();
call(options.extractors[type], node, exported, options);
}
function validate(node, exported, options) {
const type = node.type();
call(options.validators[type], node, exported, options);
}
function handle(node, exported, options) {
validate(node, exported, options);
extract(node, exported, options);
}
exports.extract = extract;
exports.validate = validate;
exports.handle = handle;