How to handle and interpolate a dynamic template literal string’s format with values that can sometimes contain all 6 variables(maximum) but can contain format with sometimes just 2 variables, sometimes with sometimes just 4 variables. Please note order for the variables can be different.
I get template literal string’s format from database for cardLabel property to display. I have a deal object and the values will come from that object: deal={group: ‘aaa’, Desc: ‘abcd’ ….etc}
cardLabel’s dynamic template literal string’s format examples:
cardLabel='{Group} {Desc} – {termMonth} Month – {termOdometer} KMs/Miles {DeductibleAmount} {DeductibleType}’;
cardLabel='{Desc} – {termMonth} Month – {termOdometer} KMs/Miles’;
cardLabel='{Desc} {Group} – {termMonth} Month’;
cardLabel='{Group} {Desc} – {termMonth} Month {DeductibleAmount}’;