Rebuilding Mustache
Published ....
Last modified ....
Share this post on BlueskySee discussion on Bluesky
I have recently been thinking a lot about template literal strings and their power within the scope of javascript.
I know that we have all decided to drop Mustache and move to react and similar libraries but I figured I would flex my muscles a bit and try to build out a very dead simple rendering function.
const render = (template, model) =>
template.replace(
/\{\{\s?([\w.]+)\s?\}\}