Files
radixOS/public/helpers/fileHelper.js
2026-04-22 12:25:45 +02:00

32 lines
1.0 KiB
JavaScript

module.exports = {
renderPartial: function(app, view, data = {}) {
return new Promise((resolve, reject) => {
app.render(view, data, (err, html) => {
if (err) return reject(err);
resolve(html);
});
});
},
// objectTree: function(context, options) {
// let ret = '';
// if (context === null || context === undefined) return ret;
// if (Array.isArray(context)) {
// context.forEach((item, index) => {
// ret += options.fn({ key: index, value: item });
// });
// } else if (typeof context === 'object') {
// for (const key in context) {
// if (context.hasOwnProperty(key)) {
// ret += options.fn({ key, value: context[key] });
// }
// }
// } else {
// // primitive Werte
// ret += options.fn({ key: null, value: context });
// }
// return ret;
// }
}