2022-07-28 21:20:53 +02:00
|
|
|
const externalHandlebars = require("./external")
|
|
|
|
const helperList = require("@budibase/handlebars-helpers")
|
|
|
|
|
2023-12-19 18:46:15 +01:00
|
|
|
let helpers = undefined
|
|
|
|
|
2022-07-28 21:20:53 +02:00
|
|
|
module.exports.getHelperList = () => {
|
2023-12-19 18:46:15 +01:00
|
|
|
if (helpers) {
|
|
|
|
return helpers
|
|
|
|
}
|
|
|
|
|
|
|
|
helpers = {}
|
2022-07-28 21:20:53 +02:00
|
|
|
let constructed = []
|
|
|
|
for (let collection of externalHandlebars.externalCollections) {
|
|
|
|
constructed.push(helperList[collection]())
|
|
|
|
}
|
|
|
|
for (let collection of constructed) {
|
|
|
|
for (let [key, func] of Object.entries(collection)) {
|
2023-12-19 18:46:15 +01:00
|
|
|
helpers[key] = func
|
2022-07-28 21:20:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (let key of Object.keys(externalHandlebars.addedHelpers)) {
|
2023-12-19 18:46:15 +01:00
|
|
|
helpers[key] = externalHandlebars.addedHelpers[key]
|
2022-07-28 21:20:53 +02:00
|
|
|
}
|
2023-12-19 18:46:15 +01:00
|
|
|
Object.freeze(helpers)
|
|
|
|
return helpers
|
2022-07-28 21:20:53 +02:00
|
|
|
}
|