Closed sanketdhoble closed 1 year ago
parse: {exec: "$", interpolate: "", raw: "~"}
. Note: to run code, you'll have to prefix it with "$": {{$ if(x) }}
useWith: true
{{it.data?.age?.test}}
@nebrelbug Thanks for clarifying point 1 & 2.
Regarding point 3. Optional chaining doesn't work with older node versions ( node 13 and below ). Plus I have to add ?
everytime in my template.
I was wondering if there is way to do this via eta
only similar to other templating tools like liquidJs, twigJs where by default it prints empty string if value is not accessible or undefined.
@sanketdhoble sure, you can define an auto-filter function to do a try-catch around interpolations.
Query-1: I changed delimter to {{ }} with
I still have to print variables using
my age is {{= it.age}}
. Is it possible to remove this=
sign from delimter syntax?Query-2: Is it possible to remove 'it' for variable and directly print it like this
my age is {{age}}
instead?Query-3: eta throws error if
age
is not present in my nested source object when trying to access,{{it.data.age.test}}
Is there a way to overcome this?