I am trying to figure out how to manipulate a string that looks like this -
"{var1} apples, {var2} oranges are expensive".
in combination with an object, which has the following structure -
{
var1 : <Link to="xyz">5</Link>,
var2 : <Link to="pqr">6</Link>
}
My goal is to create a generic method in TypeScript that can take in a string and object as input, and based on the keys of the object, generate an array similar to this pattern -
[
<Link to="xyz">5</Link>,
" apples, ",
<Link to="pqr">6</Link>,
" oranges are expensive."
]