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.
24 lines
753 B
24 lines
753 B
// TODO: This file was created by bulk-decaffeinate.
|
|
// Sanity-check the conversion and remove this comment.
|
|
/*
|
|
* decaffeinate suggestions:
|
|
* DS101: Remove unnecessary use of Array.from
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
*/
|
|
app.templates.render = function (name, value, ...args) {
|
|
const template = app.templates[name];
|
|
|
|
if (Array.isArray(value)) {
|
|
let result = "";
|
|
for (var val of Array.from(value)) {
|
|
result += template(val, ...Array.from(args));
|
|
}
|
|
return result;
|
|
} else if (typeof template === "function") {
|
|
return template(value, ...Array.from(args));
|
|
} else {
|
|
return template;
|
|
}
|
|
};
|