Is there any way to parse data to a .yaml
file in node.js? I've been searching about this for hours and found nothing useful.
Let's say I have a string in a .yaml
file:
message: Hello, ${user.fullName}, have a nice day.
As I've been reading, there's something called "placeholders" but it seems only available in spring framework.
And in other places, they use a different syntax like {{user.fullName}}
So, is there any way to replace ${user.fullName}
with an actual value in node.js? I don't know if I should manually handle this thing that they call "placeholder" myself with string.replace()
. I checked the main YAML docs and there's nothing called "placeholder" or even "variable" in their entire docs!
But, similarly, I can achieve a similar result with pug.js
using #{user.fullName}
(with #
instead) and then call something like: pug.renderFile('template.pug', {fullName: 'Timothy'})
. Check pug.js
docs for more details.
Thanks for your help!