1
0
Fork 0
mirror of synced 2024-10-03 19:43:32 +13:00

Merge pull request #12809 from Budibase/fix/uuid-hbs-to-js

Fix converting UUID from HBS to js
This commit is contained in:
Adria Navarro 2024-01-19 12:59:18 +01:00 committed by GitHub
commit edb6d95edd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -112,7 +112,7 @@ module.exports.convertHBSBlock = (block, blockNumber) => {
const list = getHelperList()
for (let layer of layers) {
const parts = splitBySpace(layer)
if (value || parts.length > 1) {
if (value || parts.length > 1 || list[parts[0]]) {
// first of layer should always be the helper
const helper = parts.splice(0, 1)
if (list[helper]) {

View file

@ -127,4 +127,12 @@ describe("Test that the string processing works correctly", () => {
"return `average: ${var1} add: ${var2}`;",
])
})
it("should handle uuids", () => {
const response = convertToJS("This is: {{ uuid }}")
checkLines(response, [
"const var1 = helpers.uuid();",
"return `This is: ${var1}`;",
])
})
})