string-template
string-template copied to clipboard
How to pass objects?
I have an object like this
let order = { owner: { firstName: "John", lastName: "Doe" } }
and this is my template
let template = "
hello {order.owner.firstName} {order.owner.lastName}
";but the output is
hello {order.owner.firstName} {order.owner.lastName}
instead of
hello John Doe
does string-template not process objects those are passed? Or there is some other way to accomplish it?
This package doesn't support nested access, it was designed to be a straight forward interpolated. If you want to use accessor notation consider https://www.npmjs.com/package/micromustache