1
0
Fork 0
mirror of synced 2024-10-01 01:28:51 +13:00

Update literal helper to return an empty string rather than the string 'undefined' when the value is undefined

This commit is contained in:
Andrew Kingston 2021-11-15 12:25:30 +00:00
parent 3470b1ea1b
commit a721619a06

View file

@ -46,6 +46,9 @@ const HELPERS = [
}), }),
// adds a note for post-processor // adds a note for post-processor
new Helper(HelperFunctionNames.LITERAL, value => { new Helper(HelperFunctionNames.LITERAL, value => {
if (value === undefined) {
return ""
}
const type = typeof value const type = typeof value
const outputVal = type === "object" ? JSON.stringify(value) : value const outputVal = type === "object" ? JSON.stringify(value) : value
return `{{${LITERAL_MARKER} ${type}-${outputVal}}}` return `{{${LITERAL_MARKER} ${type}-${outputVal}}}`