mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
366 B
16 lines
366 B
app.templates.render = function (name, value, ...args) {
|
|
const template = app.templates[name];
|
|
|
|
if (Array.isArray(value)) {
|
|
let result = "";
|
|
for (var val of value) {
|
|
result += template(val, ...args);
|
|
}
|
|
return result;
|
|
} else if (typeof template === "function") {
|
|
return template(value, ...args);
|
|
} else {
|
|
return template;
|
|
}
|
|
};
|